Learn Node JS with MySQL APIs Development Beginners Tutorial | Get Specific Row by URL Parameter ID

Опубликовано: 31 Январь 2020
на канале: Online Web Tutor
712
15

In this video we'll see:

Learn Node JS with MySQL APIs Development Beginners Tutorial | Get Specific Row by URL Parameter ID

#nodejs
#node
#nodedevelopment
#learnnodejs
#nodemysql
#nodewithmysql

const express = require("express");

const app = express();

const PORT = 5000;

// load mysql package
const mysql = require("mysql");

// create mysql connection
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "root",
database: "node_db"
});

// check connection
connection.connect(function (error) {

if (error) {
throw error;
} else {
console.log("We are now successfully connected with mysql database");
}
});


// get all data api
app.get("/users", function (request, response) {

// query
connection.query("SELECT * from tbl_users", function(error, results, fields){

if(error){
throw error;
}else{
response.json(results);
//console.log(fields);
}
});
});

// get data via id
app.get("/user/:id", function(request, response){

var userID = request.params.id;

// query
connection.query("SELECT * from tbl_users WHERE id = ?", [userID], function(error, results, fields){

if(error){
throw error;
}else{
response.json(results);
}
});
});


app.get("/", function (request, response) {

response.send("Welcome to Initial stage of MySQL");
});

app.listen(PORT, function () {

console.log("Server is running at 5000 port");
});


SOCIAL :
===============
Subscribe :    / owthub  
FACEBOOK :   / owthub  
TWITTER:   / owthub  
BLOG: https://onlinewebtutorhub.blogspot.in/
UDEMY: https://www.udemy.com/user/online-web...

Other Tutorials
===============
Wordpress Customizations:
---------------------------------
Wordpress Theme (Hindi): https://goo.gl/MZ8maF
Wordpress Widget (Hindi): https://goo.gl/Dc2htn
Wordpress Plugin (English): https://goo.gl/BA7dYG
Wordpress Theme Options (English): https://goo.gl/Vjv3Ub
Wordpress JSON Rest API (English): https://goo.gl/SVQRQR
Wordpress JSON Rest API (Hindi): https://goo.gl/NNWfKa
and many more...

Javascript framework:
----------------------------------
Learn backbone.js here! (English) : https://goo.gl/Qd2Pcs
Learn Vue JS here ! (Hindi): https://goo.gl/MVtsmh

PHP Frameworks:
----------------------------------
Laravel tutorial (Hindi): https://goo.gl/Nh9qJk
CakePHP tutorial (Hindi): https://goo.gl/uRsS3G

Tags:
----------------------------------
node,
node.js,
node api,
node with express apis,
node express with mysql apis,
node mysql,
mysql node apis,
node mysql api tutorial,
node restful api tutorial with mysql,
express mysql node api,
node express apis,
node restful apis with mysql,
learn node js with mysql,
node js express and mysql,
restful node apis development tutorial,
node js apis development tutorial from scratch,
node express tutorial,
create restful api nodejs mysql,
online web tutor,
online web tutor node js express mysql,
online web tutor node restful apis development,


Thanks
Online Web Tutor
Keep learning and Sharing :)


Смотрите видео Learn Node JS with MySQL APIs Development Beginners Tutorial | Get Specific Row by URL Parameter ID онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Online Web Tutor 31 Январь 2020. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 712 раз и оно понравилось 15 посетителям.