-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
37 lines (20 loc) · 747 Bytes
/
server.js
File metadata and controls
37 lines (20 loc) · 747 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
30
31
32
33
34
require( 'dotenv' ).config() // looks for .env ; process.env gets it's values
const socket = require('./app/router/socket.js');
const bodyParser = require('body-parser')
const express = require('express');
const apiRouter = require('./app/router/router.js');
const app = express();
const http = require('http').createServer(app);
const PORT = process.env.PORT || 3000
// for parsing incoming POST data
//app.use(express.urlencoded({ extended: true }))
//app.use(express.json())
app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json())
// for serving all the normal html
app.use( express.static('public') );
socket(http)
apiRouter(app)
http.listen(3000, () => {
console.log('SERVER LISTENING ON *:3000');
});