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

express-server-control

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-server-control

Control the setup process of express applications

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 20 Sep 2021

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