Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mands/mns-fe-server

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mands/mns-fe-server

A server, wrapping Express for use within M&S front-end projects.

  • 3.0.2
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 15 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc