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

moleculer-web

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moleculer-web

Official API Gateway service for Moleculer framework

  • 0.10.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-8.09%
Maintainers
3
Weekly downloads
 
Created
Source

Moleculer logo

Node CI Coverage Status Codacy Badge Maintainability David Known Vulnerabilities Join the chat at https://gitter.im/moleculerjs/moleculer

Official API Gateway for Moleculer framework NPM version

The moleculer-web is the official API gateway service for Moleculer. Use it to publish your services.

Features

  • support HTTP & HTTPS
  • 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-2021 MoleculerJS

@moleculerjs @MoleculerJS

Keywords

FAQs

Package last updated on 17 Dec 2022

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