Socket
Socket
Sign inDemoInstall

express-server-control

Package Overview
Dependencies
63
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-server-control

Control the setup process of express applications


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ExpressServer

Control the setup process of Express apps services and dependencies.

Coverage Status Install Size Dependency Count

Install

$ npm install --save express-server-control

Usage

import { ExpressServer } from 'express-server-control';

export const mainServer = new ExpressServer({
  port: 8080,
  name: 'mainServer',
  beforeConfig: [ // An array of function that will run in series before mounting middleware
    // e.g. database connection init, load encryption keys etc.
    // note that functions refferences are passed as arguments and called later by the class 
    loadfKeys,
    initDbConnection,
    //...
  ],
  middleware: [ // middleware mounted with app.use(...)
    // e.g
    compression(),
    cookieParser(),
    // ...
  ],
  tests: [ // a set of tests to run before the server calls app.listen
    // e.g. database connection test
    // see ServerTest class
    testDB()
    //...
  ],
  afterListen: [ // functions that will run in series after app has started listening and 
    // all test were executed successfully.
    InitWebSockets
  ]
});


try {
  // run configuration functions
  await MainServer.config();
  // listen
  await mainServer.listen();
} catch (e) {
  console.error(e);
}


Further information coming soon...

Keywords

FAQs

Last updated on 20 Sep 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc