4.0.0 • Published 2 years ago
@mands/mns-fe-server v4.0.0
mns-fe-server
This module is a wrapper around the node Express.js server. It takes a single configuration object with the following properties:
Name | Type | Description |
---|---|---|
assetsDir | string | Dir to serve static files such as images, CSS files, and JavaScript files |
jsonLogging | function | Function used for logging events, can be used with @mands/mns-fe-foundation/src/components/logger |
logger | boolean | Enable or Disable logging |
routesDir | function | A function that returns the path to the routes directory |
handlebars | object | Handlebars view engine object |
pageNotFoundHandler | function | A mapping to a handler for 404 status events |
errorPageHandler | function | A mapping to a handler for 500 status events |
ExposeRoutes | function | Function which returns a dir with the exposed routes |
Installation and usage
To install mns-fe-server
into your application please run:
npm install --save @mands/mns-fe-server
Include the module and start:
const config = require('./configuration/server')
let server = require('@mands/mns-fe-server')(config)
server.start()
Here's an example configuration object to get you started.
Supplying application specific middlewares
Providing a custom middleware is as simple as adding middlewares
method to config/server.js
. For example:
const middleware = require('<path to middleware>');
const middlewares = server => {
server.use(middleware);
}
module.exports = {
middlewares,
analyticsEnv,
env,
routes,
assetsDir,
jsonLogging,
...
...
}
Documents
Contacts
- Email: pegasus@mnscorp.onmicrosoft.com
- Jira: https://jira.devops.mnscorp.net/projects/FESK
4.0.0
2 years ago
3.3.0
3 years ago
3.2.0
4 years ago
3.1.0
4 years ago
3.0.2
4 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.5.1
5 years ago
2.5.0
5 years ago
2.4.0
5 years ago
2.3.0
7 years ago
2.2.3
7 years ago
2.2.2
7 years ago
2.2.1
7 years ago
2.2.0
7 years ago
2.1.2
7 years ago
2.1.1
7 years ago
2.1.0
7 years ago
2.0.0
7 years ago
1.5.1
7 years ago
1.5.0
7 years ago
1.4.0
7 years ago
1.3.0
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago