Created
September 23, 2014 02:35
-
-
Save L8D/1c5e04e4c5c414c14aa1 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
| var parser = require('body-parser') | |
| , config = require('./config') | |
| , express = require('express') | |
| , morgan = require('morgan') | |
| , _ = require('lodash') | |
| , path = require('path') | |
| ; | |
| var app = module.exports = express(); | |
| app | |
| .use(morgan(config.env === 'development' ? 'combine' : 'dev')) | |
| .use(express.static(path.resolve(__dirname + '/public'))) | |
| .use(express.static(path.resolve(__dirname + '/dist'))) | |
| .use(parser.json()) | |
| ; | |
| app.use(function(req, res) { | |
| res.status(404); | |
| if (req.accepts('html')) { | |
| res.sendfile(path.resolve(__dirname + '/public/404.html')); | |
| } else { | |
| res.send('Not found'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment