moleculerjs / moleculer-web

:earth_africa: Official API Gateway service for Moleculer framework
http://moleculer.services/docs/moleculer-web.html
MIT License
295 stars 118 forks source link
api-gateway gateway hacktoberfest http-server microservices moleculer

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

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:

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