diff options
Diffstat (limited to 'src/app.js')
-rw-r--r-- | src/app.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/app.js b/src/app.js deleted file mode 100644 index 0b0b3cd..0000000 --- a/src/app.js +++ /dev/null @@ -1,40 +0,0 @@ -import express from 'express'; -import path from 'path'; -import logger from 'morgan'; -import bodyParser from 'body-parser'; -import routes from './routes'; - -const app = express(); -app.disable('x-powered-by'); - -// View engine setup -app.set('views', path.join(__dirname, '../views')); -app.set('view engine', 'pug'); - -app.use(logger('dev', { - skip: () => app.get('env') === 'test' -})); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({extended: false})); -app.use(express.static(path.join(__dirname, '../dist'))); - -// Routes -app.use('/', routes); - -// Catch 404 and forward to error handler -app.use((req, res, next) => { - const err = new Error('Not Found'); - err.status = 404; - next(err); -}); - -// Error handler -app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars - res - .status(err.status || 500) - .render('error', { - message: err.message - }); -}); - -export default app; |