mycro-express
v1.0.0
Published
express hook for mycro apps
Downloads
3
Readme
mycro-express
an express hook for mycro apps.
Installing
npm install --save mycro-express
Configuration
// in /config/express.js
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const methodOverride = require('method-override');
module.exports = function(mycro) {
return function configureExpress(app, done) {
app.use(logger('dev'));
app.use(bodyParser.json({ limit: '500kb' }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride());
const env = process.env.NODE_ENV || 'development';
app.set('env', env);
if (/test/.test(env)) {
app.set('debug', true);
}
const port = process.env.PORT || 8080;
app.set('port', port);
process.nextTick(done.bind(null, null, app));
}
}
Testing
run tests
npm test
run coverage
npm run coverage
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
Copyright (c) 2016 Chris Ludden. Licensed under the MIT license.