-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (23 loc) · 858 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
const util = require( 'util' ),
path = require( 'path' ),
express = require( 'express' ),
cors = require( 'cors' ),
compression = require( 'compression' ),
exphbs = require( 'express-handlebars' ),
bodyParser = require( 'body-parser' ),
helpers = require( __dirname + '/helpers/general.js' ),
app = express( );
app.use( compression() );
app.use( express.static( 'public' ) );
app.use( bodyParser.urlencoded( {
extended: true
} ) );
app.use( bodyParser.json() );
app.engine( 'handlebars', exphbs( { defaultLayout: 'main' } ) );
app.set( 'views', __dirname + '/views' );
app.set( 'view engine', 'handlebars' );
app.use( '/', require( './routes/index.js' ) )
app.get( '/js/helpers.js', function (req, res) {
res.sendFile( path.join( __dirname + '/helpers/general.js' ) );
} );
module.exports = app;