4.0.0 • Published 1 year ago

@mands/mns-fe-server v4.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

mns-fe-server

Contributing Guide

NPM version Node version

This module is a wrapper around the node Express.js server. It takes a single configuration object with the following properties:

NameTypeDescription
assetsDirstringDir to serve static files such as images, CSS files, and JavaScript files
jsonLoggingfunctionFunction used for logging events, can be used with @mands/mns-fe-foundation/src/components/logger
loggerbooleanEnable or Disable logging
routesDirfunctionA function that returns the path to the routes directory
handlebarsobjectHandlebars view engine object
pageNotFoundHandlerfunctionA mapping to a handler for 404 status events
errorPageHandlerfunctionA mapping to a handler for 500 status events
ExposeRoutesfunctionFunction 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

4.0.0

1 year ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago