Last active
May 29, 2017 22:09
-
-
Save byverdu/e743570bca730647f68310ac7c422dfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Express from 'express'; | |
import pathUtil from 'path'; | |
import { DBDisconnect } from '../../utils'; | |
import { rootPath } from '../../conf'; | |
const bodyParser = require( 'body-parser' ); | |
const allRoutes = require( './routes' ); | |
const notFoundRoute = require( './routes/404' ); | |
if ( process.env.NODE_ENV !== 'test' ) { | |
require( './db' )(); | |
} | |
const app = Express(); | |
app.set( 'views', './app/client/views' ); | |
app.set( 'view engine', 'pug' ); | |
app.use( Express.static( pathUtil.join( rootPath, '/app/client' ))); | |
app.use( bodyParser.json()); | |
app.use( '/', allRoutes ); | |
app.use( notFoundRoute ); | |
process.on( 'SIGINT', DBDisconnect ).on( 'SIGTERM', DBDisconnect ); | |
module.exports = app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment