-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (23 loc) · 937 Bytes
/
server.js
File metadata and controls
29 lines (23 loc) · 937 Bytes
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
//Dependencies
var express = require("express");
var bodyParser = require("body-parser");
var path = require("path");
// Sets up the Express App
// =============================================================
var app = express();
var PORT = process.env.PORT || 3000;
// Sets up the Express app to handle data parsing
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.text());
app.use(bodyParser.json({ type: "application/vnd.api+json" }));
//Initiates htmlRoutes.js routes
var htmlRoutes = require('./app/routing/htmlRoutes.js')(app,path);
//Initiates apiRoutes.js routes
var apiRoutes = require('./app/routing/apiRoutes.js')(app,path);
//Servers public content such as CSS Javascript required in the HTML files
app.use(express.static(path.join(__dirname,'app/public')));
//Listening to the server port
app.listen(PORT,()=>{
console.log('Server listening on PORT ' + PORT);
});