-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (28 loc) · 929 Bytes
/
app.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
30
31
32
33
34
const express = require('express'),
path = require('path'),
cookieParser = require('cookie-parser'),
lessMiddleware = require('less-middleware'),
logger = require('morgan'),
fs = require('fs'),
http = require('http'),
https = require('https'),
indexRouter = require('./routes/index'),
usersRouter = require('./routes/users');
const PORT = 4000;
const app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('images', path.join(__dirname, 'images'));
app.set('view engine', 'pug');
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(lessMiddleware(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.listen(PORT, () => {
console.log(`listening on port ${PORT}`);
});
module.exports = app;