![Test Coverage](https://api.codeclimate.com/v1/badges/d49bb1ffdcb679b6fe37/test_coverage)
systemic-express
A systemic set of components for making easier setting up systemic-based express applications. These components are:
App
This component contains customizable express application configuration. The whole list of options can be found here.
const System = require ('systemic');
const app = require('systemic-express').app
new System()
.configure({
app: {
etag: false,
'x-powered-by': false,
}
})
.add('app', app()).dependsOn('config')
Default middleware
Provides two different middlewares that can be attached to the previously created application as root level middlewares. By default, this middlewares will log errors, but they can be easily overridden by passing a configuration object to the component as follows:
const System = require ('systemic');
const app = require('systemic-express').app
const defaultMiddleware = require('systemic-express').defaultMiddleware
const routes = require('./lib/routes')
new System()
.configure({
app: {
etag: false,
'x-powered-by': false,
},
'middleware.default': {
notFound(err, req, res, next) {
},
error(err, req, res, next) {
}
}
})
.add('app', app()).dependsOn('config')
.add('routes', routes()).dependsOn('app')
.add('middleware.default', defaultMiddleware()).dependsOn('routes', 'app')
Server
This component makes easier to set up the express server that will expose your application. It accepts the same options as the listen method:
const System = require('systemic')
const server = require('systemic-express').server
const app = require('systemic-express').app
const defaultMiddleware = require('systemic-express').defaultMiddleware
const routes = require('./lib/routes')
new System()
.configure({
server: {
host: '0.0.0.0',
port: 3000
},
app: {
etag: true
}
})
.add('app', app()).dependsOn('config')
.add('routes', routes()).dependsOn('app')
.add('middleware.default', defaultMiddleware()).dependsOn('routes', 'app')
.add('server', server()).dependsOn('config', 'app', 'middleware.default')
.start((err, components) => {
})