forked from inovizz/library_management_system_blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (24 loc) · 719 Bytes
/
index.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
const path = require('path');
const express = require('express');
const app = express();
const config = require('./server/config');
const routes = require('./server/routes');
const bodyParser = require('body-parser');
// Middlewares
app.use(express.static(__dirname + '/dist'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
// Routing
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname,'dist','index.html'));
});
const api = require('./server/routes')(app, express);
app.use('/api',api);
// Start Server
app.listen(config.port, 'localhost', function(err) {
if (err) {
console.log(err);
return;
}
console.log(`Listening on ${config.base_url}`);
});