rest api node js with mysql
const express = require('express'),
app = express(),
bodyParser = require('body-parser');
port = process.env.PORT || 3000;
const mysql = require('mysql');
// connection configurations
const mc = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'mydb'
});
// connect to database
mc.connect();
app.listen(port);
console.log('API server started on: ' + port);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
var routes = require('./app/routes/approutes'); //importing route
routes(app); //register the route
Also in JavaScript:
- javascript json trypass
- javascript reverse a string
- display amount with currency for jquery
- pdf javascript search text
- how to check if enter is pressed javascript
- javascript some
- nativescript absolutelayout bottom
- if member has role discord.js
- sort javascript array
- how to add class to button in javascript
- jquery select2 multiple select all
- for each python json
- how to send json data in fetch request body
- what is pug template engine
- get the state of a checkbox
- find length of longest string in array javascript
- how to make lines glow canvas
- what is nodes and hubs in selenium grid
- Javascript looping through table
- adonis migration column char
- how to make a vowel counter in javascript
- upload image and video cloudinary expressjs
- Object destructuring
- javascript remove character from string