-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
36 lines (26 loc) · 816 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
const mysql = require("mysql");
const express = require("express");
const path = require("path");
var app = express();
var port=3000;
var mysqlConnection = mysql.createConnection({
host : 'database-node.cu3tii08dxzj.us-east-1.rds.amazonaws.com',
port : '3306',
user : 'admin',
password : 'password',
database : 'Users',
});
mysqlConnection.connect((err)=>{
if(err) throw err;
console.log("connected");
});
const PublicDirectory=path.join(__dirname,'./public');
app.use(express.urlencoded({extended:false}));
app.use(express.json());
app.use(express.static(PublicDirectory));
app.set("view engine","hbs");
app.use('/',require('./routes/routers'));
app.use('/authorize',require('./routes/authorize'));
app.listen(port,()=>{
console.log("Application started at Port 3000")
});