@server-state/server-base
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

server-base

Build Status GitHub npm version

Server-side (NodeJS based) implementation of the server-base architecture (no modules included).

It manages server modules and can get attached to an express app, where it creates routes under /api/v1/, as specified in https://github.com/server-state/specs/blob/master/api/routes.md.

Example

let app; // An express app

const ServerState = require('@server-state/server-base');

const server = new ServerState({
	logToConsole: true, // Log error messages to console, ...
	logToFile: false // ... but not to a file
});

// Add module under name 'raw'. Will add it to /api/v1/all and create /api/v1/raw
server.addModule('raw', require('@server-state/raw-module'), [
	'ls',
	'whoami'
]);

server.init(app); // Attach the server-state server to the express app

app.listen(8080); // "Start" the express app

Package Sidebar

Install

npm i @server-state/server-base

Weekly Downloads

6

Version

0.2.0

License

MIT

Unpacked Size

17 kB

Total Files

7

Last publish

Collaborators

  • fussel178
  • pklaschka
  • server-state-ci