Socket
Socket
Sign inDemoInstall

sputnik

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sputnik

Stage based flow control for booting a server


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Sputnik

Stage based flow control, used for bootstrapping a Node.js server.

The stages themselves are executed in parallel.

Installation

$ npm install sputnik

What is it for?

It is mainly meant for booting code where you work with plugins.

You define several 'stages' that have functions attached to them.

Then you run your plugins, which can hook into those named stages and run code before or after said stages.

Then you finally 'launch' the rocket and watch your server boot in the order you want.

Functions

Sputnik([options])

Create a new Sputnik

var sputnik = new Sputnik();

add(name, function)

Define a stage function, but do not begin it just yet. You can return a promise to make the stage wait from ending.

sputnik.add(function datasources() {
	// Do some stuff
});

get(name)

Get a stage. Define it (as empty) if it doesn't exist yet.

launch(name)

Begin the stage

after(name, function)

Similar to before()

sputnik.after('datasources', function() {
  // This will only run after datasources has ended
);

The name parameter can be an array of stage names, then the function will then only be executed when all of the stages has finished.

sputnik.after(['init', 'datasources', 'startServer'], function() {
  // This will only run after init, datasources & startServer have ended
);

Keywords

FAQs

Package last updated on 21 Jul 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