Nodejs

No description

fork
loading
Files
  • index.js
  • controllers
  • public
  • socket
  • views
  • package-lock.json
  • package.json
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
console.log('server starting')

const express = require('express');
const http = require('http');
const pug =  require('pug');

const app = express();
const server = http.createServer(app);

app.engine('pug', pug.__express);
app.set('view engine', 'pug');
app.use(express.static(__dirname + '/public'))
app.use(require('./controllers'));
app.use(require('cookie-parser')());
app.use(require('body-parser').urlencoded({ extended: true }));
app.use(require('express-session')({ 
    secret: 'keyboard cat', 
    resave: true, saveUninitialized: true 
}));



server.listen(3000, function() {
  console.log('Listening on port 3000...')
})
node v10.16.0