forked from Team-CodeX/project-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
24 lines (17 loc) · 774 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
'use strict';
require('dotenv').config({ silent: true });
const express = require('express');
const logger = require('morgan');
const path = require('path');
const bodyParser = require('body-parser');
const history = require('connect-history-api-fallback');
const app = express();
const PORT = process.argv[2] || process.env.PORT || 3000;
app.use(logger('dev'));
app.use(bodyParser.json());
// app.use(bodyParser.urlencoded({ extended: true }));
app.use('/api/v1', require('./routes/api.js'));
app.use(history({ logger: logger }))
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'dist')));
app.listen(PORT, () => console.warn(`Server here! Listening on port ${PORT}!`));