-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (19 loc) · 684 Bytes
/
app.js
File metadata and controls
24 lines (19 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var config = require('config');
var express = require('express');
var logger = require('morgan');
var app = new express();
// ## Middleware
app.use(logger('dev'));
app.use(express.static(__dirname + '/public'));
app.use(express.static(__dirname));
// ## Routes
if (config.env === 'dev') {
// In dev, will use in-memory bundle.js that automatically watches for changes:
var webpackMiddleware = require('webpack-dev-middleware');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
app.use(webpackMiddleware(webpack(webpackConfig), {}));
}
app.listen(config.port, function () {
console.log('Server running on port ' + config.port);
});