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

moleculer-web

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moleculer-web - npm Package Versions

1
56

0.3.0

Diff

Changelog

Source

0.3.0 (2017-06-01)

New

Named parameters in aliases

It is possible to use named parameters in aliases. Named paramters are defined by prefixing a colon to the parameter name (:name)

Usage

broker.createService(ApiGatewayService, {
    settings: {
        routes: [{
            path: "/api",

            aliases: {
                "GET greeter/:name": "test.greeter",
                "optinal-param/:name?": "test.echo",
                "repeat-param/:args*": "test.echo",
                "GET /": "test.hello"                
            }
        }]
    }
});

// Start server
broker.start();

Example: examples/full


<a name="0.2.2"></a>

icebob
published 0.2.3 •

icebob
published 0.2.2 •

Changelog

Source

0.2.2 (2017-06-01)

New

Before & after call hooks

The route of service has onBeforeCall and onAfterCall hooks. It can be asynchronous if return with Promise. In methods the this is pointed to Service instance. So you can access the service methods & broker.

Usage

broker.createService(ApiGatewayService, {
    settings: {
        routes: [{
            // Call before `broker.call`
            onBeforeCall(ctx, route, req, res) {
                // Save request headers to context meta
                ctx.meta.userAgent = req.headers["user-agent"];
            },

            // Call after `broker.call` and before send back the response
            onAfterCall(ctx, route, req, res, data) {
                res.setHeader("X-Custom-Header", "123456");
            }
        }]
    }
});

// Start server
broker.start();

Example: examples/full


<a name="0.2.1"></a>

icebob
published 0.2.1 •

Changelog

Source

0.2.1 (2017-05-23)

New

ExpressJS middleware usage

You can use Moleculer-Web as a middleware for ExpressJS.

Usage

const svc = broker.createService(ApiGatewayService, {
    settings: {
        middleware: true
    }
});

// Create Express application
const app = express();

// Use ApiGateway as middleware
app.use("/api", svc.express());

// Listening
app.listen(3000);

// Start server
broker.start();

Example: examples/express


<a name="0.2.0"></a>

icebob
published 0.2.0 •

Changelog

Source

0.2.0 (2017-05-09)

New

Support custom authorization

For more information check the full or authorization examples or readme


<a name="0.2.0"></a>

icebob
published 0.1.1 •

icebob
published 0.1.0 •

Changelog

Source

0.1.0 (2017-05-08)

First release.

1
56
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