-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
44 lines (31 loc) · 913 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const express = require('express'),
app = express(),
bodyParser = require('body-parser');
port = process.env.PORT || 5000;
var cors = require('cors')
const mysql = require('mysql');
// connection configurations
const mc = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'root123',
database: 'cicd'
});
// 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
var assert = require('assert');
function add (a, b) {
return a + b;
}
var expected = add(1,2);
assert( expected === 3, 'one plus two is three');
var path = require("path");
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});