-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathapp.js
34 lines (26 loc) · 928 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');
const app = express();
const favicon = require('serve-favicon');
const path = require('path');
const bodyParser = require('body-parser');
const index = require('./controllers/index');
const mail = require('./controllers/mail');
const success = require('./controllers/success');
app.use(express.static(path.join(__dirname, 'static')));
app.use(favicon(path.join(__dirname, 'static', 'favicon.ico')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.set('views', path.join(__dirname, 'view'));
app.set('view engine', 'ejs');
app.use('/', index);
app.use('/success', success);
app.use('/mail', mail);
// catch 404 and forward to error handler
app.use(function (req, res, next) {
const err = new Error('Not Found');
err.status = 404;
next(err);
});
app.listen(5000, function () {
console.log('listening on http://localhost:5000');
});