-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (20 loc) · 792 Bytes
/
Copy pathserver.js
File metadata and controls
27 lines (20 loc) · 792 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
'use strict';
const express = require('express')
const config = require('./server/config/config')
const bodyParser = require('body-parser')
const app = express()
const db = require('./server/config/db')
const path = require('path')
const logger = require('morgan')
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'client/')));
app.use(logger('dev'));
app.get('*', function(req, res) {
res.sendFile(path.resolve('client/index.html')); // load the single view file (angular will handle the page changes on the front-end)
});
/** load routes*/
require('./server/user/user.server.routes')(app);
var port = config.server.port;
app.listen(process.env.PORT || port);
console.log('App started on port ' + port);