moleculer-suspend
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Moleculer logo

Suspend service mixin for Moleculer

The moleculer-suspend is small mixin for Moleculer. Use it to publish your services.

Features

  • suspend/resume service
  • serve static files
  • multiple routes
  • support global, route, alias middlewares
  • support file uploading
  • alias names (with named parameters & REST shorthand)
  • whitelist
  • multiple body parsers (json, urlencoded)
  • CORS headers
  • ETags
  • HTTP2
  • Rate limiter
  • before & after call hooks
  • Buffer & Stream handling
  • middleware mode (use as a middleware in ExpressJS Application)
  • support authorization

Install

npm install moleculer-web --save

Usage

Run with default settings

This example uses API Gateway service with default settings. You can access to all services (including internal $node.) via http://localhost:3000/

let { ServiceBroker } = require("moleculer");
let ApiService = require("moleculer-web");

let broker = new ServiceBroker({ logger: console });

// Create a service
broker.createService({
    name: "test",
    actions: {
        hello() {
            return "Hello API Gateway!"
        }
    }
});

// Load API Gateway
broker.createService(ApiService);

// Start server
broker.start();

Test URLs:

  • Call test.hello action: http://localhost:3000/test/hello

  • Get health info of node: http://localhost:3000/~node/health

  • List all actions: http://localhost:3000/~node/actions

Documentation

Please read our documentation on Moleculer site

Test

$ npm test

In development with watching

$ npm run ci

License

Moleculer-web is available under the MIT license.

Contact

Copyright (c) 2016-2017 MoleculerJS

@moleculerjs @MoleculerJS

Package Sidebar

Install

npm i moleculer-suspend

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

10.4 kB

Total Files

6

Last publish

Collaborators

  • alexm108dev