https://github.com/cludden/mycro-express
express hook for mycro apps
https://github.com/cludden/mycro-express
Last synced: over 1 year ago
JSON representation
express hook for mycro apps
- Host: GitHub
- URL: https://github.com/cludden/mycro-express
- Owner: cludden
- License: mit
- Created: 2016-08-05T02:54:33.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-05T02:55:39.000Z (almost 10 years ago)
- Last Synced: 2025-03-14T12:06:13.455Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mycro-express
an [express]() hook for [mycro](https://github.com/cludden/mycro) apps.
## Installing
```bash
npm install --save mycro-express
```
## Configuration
```javascript
// 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
```javascript
npm test
```
run coverage
```javascript
npm run coverage
```
## Contributing
1. [Fork it](https://github.com/cludden/mycro-express/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## License
Copyright (c) 2016 Chris Ludden.
Licensed under the [MIT license](LICENSE.md).