Posts

Showing posts with the label mysql

Go Language, MYSQL - Simple Rest CRUD API example

Image
In this article, we will show you how to develop a  REST-style web service with Go Language and MYSQL. These are APIs that Spring backend App will export: GET all User's        :   /users GET User by ID     :   /users/{id}  POST User             :   /users PUT User               :   /users DELETE User       :   /users/{id} Technologies used: Go Language MYSQL Database gorilla/mux jinzhu/gorm gorilla/mux:  The gorilla/mux package provides request routing, validation, and other services. jinzhu/gorm:  The gorm is an ORM library for the Go language.GORM provides CRUD operations and can also be used for the initial migration and creation of the database schema. Final Project Structure: Let's start building the application Create database 'userdb': CREATE DATABASE userdb; Initialize the Go project: Initialize the Go project  using the following command go mod init rest-crud-api-go-lang Adding the modules required for the project: go get github.com/gorilla/mux go get github.c

CakePHP - Environment Setup - Ubuntu

Image
Hello everyone, In this tutorial, we will set up a CakePHP development environment in Ubuntu. We’ll install Apache2 HTTP, MariaDB, PHP 7.2, Composer and CakePHP in order to provide you with the tools necessary for developing web applications with  CakePHP . Step 1 — Install Apache2 HTTP Apache is available within Ubuntu’s default software repositories, making it possible to install it using conventional package management tools.  Let’s begin by updating the local package index to reflect the latest upstream changes: $ sudo apt-get update && sudo apt-get -y upgrade Then, install the apache2 package: $ sudo apt install apache2 After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots. $ sudo systemctl stop apache2.service $ sudo systemctl start apache2.service $ sudo systemctl enable apache2.service Confirm whether apache is successfully installed on your machine. http://loca

CakePHP + MySQL CRUD Example

Image
Hello everyone, today we will learn how to develop a basic User Management Application using CakePHP and MySQL. -Add User: - Retrieve all Users: -Update User: Step 1 —  CakePHP - Environment Setup  - click here Step 2 — Create table_users CREATE TABLE IF NOT EXISTS tbl_users ( id int ( 10 ) unsigned NOT NULL AUTO_INCREMENT, name varchar ( 120 ) COLLATE utf8_unicode_ci NOT NULL , email varchar ( 120 ) COLLATE utf8_unicode_ci NOT NULL , phone_no varchar ( 30 ) COLLATE utf8_unicode_ci NOT NULL , PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE =utf8_unicode_ci; Step 3 —  Add CRUD routes[routes.php ] Go to var >> www >> cakephp >> app >> config >> routes.php <?php use Cake\Routing\Route\DashedRoute; use Cake\Routing\RouteBuilder; return static function (RouteBuilder $routes) { $routes->setRouteClass(DashedRoute:: class ); $routes->scope( '/' , function (RouteBuilder $builder) {