-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
39 lines (26 loc) · 841 Bytes
/
app.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
// Server
// Dependencies
// Using dotenv as configuration deps.
require('dotenv').config();
const express = require("express"),
bodyParser = require('body-parser'),
cors = require("cors");
// Initiate your server application
const app = express(),
port = process.env.PORT || 3333;
//Enable Cross Origin Resource Sharing
app.use(cors());
//Add body-parser to process data attached to body on http request
app.use(bodyParser.urlencoded({
extended:true
}));
app.use(bodyParser.json());
//Initiate database connection
var db = require('./src/config/database');
// Extend application routes
var UserRouter = require('./src/routers/UserRouter');
app.use('/',[UserRouter]);
// Start your server on specified port
app.listen(port);
// If you see this, you are all set.
console.log("Welcome to "+port+" Baker Street!");