• Stars
    star
    291
  • Rank 142,563 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌍 Official API Gateway service for Moleculer framework

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

More Repositories

1

moleculer

πŸš€ Progressive microservices framework for Node.js
JavaScript
6,089
star
2

awesome-moleculer

πŸš€ A list of awesome things related to Moleculer microservices framework
JavaScript
361
star
3

moleculer-examples

🎲 Examples for Moleculer microservices framework
HTML
160
star
4

moleculer-db

πŸ”‹ Database access service mixins for Moleculer
JavaScript
152
star
5

moleculer-template-project-typescript

Typescript project template for Moleculer microservices framework.
TypeScript
122
star
6

moleculer-apollo-server

πŸš€ Apollo GraphQL server for Moleculer
JavaScript
100
star
7

moleculer-addons

🎁 Official addons for Moleculer framework
JavaScript
86
star
8

moleculer-io

Socket.io API GateWay service for Moleculer framework
JavaScript
80
star
9

moleculer-channels

Reliable messages for Moleculer services via external queue/channel/topic.
JavaScript
72
star
10

moleculer-realworld-example-app

🌏 RealWorld example app with Moleculer microservices framework
JavaScript
54
star
11

moleculer-cli

🌿 Command line tool for Moleculer
JavaScript
48
star
12

moleculer-metrics

πŸ“ˆ Official monitoring & metrics addons for Moleculer framework
JavaScript
47
star
13

database

Advanced Database Access Service for Moleculer microservices framework
JavaScript
32
star
14

moleculer-repl

REPL module for Moleculer framework
JavaScript
27
star
15

moleculer-cheatsheets

πŸ“š Cheatsheets for Moleculer microservices framework
JavaScript
26
star
16

moleculer-template-project

πŸŽ“ Common project template for Moleculer-based projects
JavaScript
21
star
17

site

🌐 Official website for Moleculer
JavaScript
21
star
18

moleculer-http-client

HTTP client mixin that allows Moleculer services to communicate with remote REST APIs
JavaScript
17
star
19

docker-demo

Kubernetes & Docker demo for Moleculer project testing & prototyping.
HTML
17
star
20

sidecar

[WIP] Sidecar for Moleculer framework with HTTP support.
JavaScript
15
star
21

moleculer-db-adapter-typeorm

typescript sql adapter using typeorm
TypeScript
10
star
22

kubernetes-demo

Kubernetes demo for Moleculer microservices framework
9
star
23

educational-content

A guide to create educational content for the Moleculer ecosystem
9
star
24

moleculer-template-nano-typescript

Minimal project template for one Moleculer microservice with typescript.
TypeScript
8
star
25

moleculer-template-nano

πŸŽ“ Minimal project template for one microservice.
JavaScript
7
star
26

perf-tester

Performance tester docker image to test your tech stack (transporter, serializer, discoverer)
JavaScript
6
star
27

sandbox-moleculer-db

Moleculer Database service sandbox for prototyping.
JavaScript
5
star
28

project-demo

Demo Project. Generated by official "project" template
JavaScript
5
star
29

moleculer-docgen

πŸ“œ Documentation generator for Moleculer services
JavaScript
5
star
30

incubator

🐣 A comprehensive Moleculer demo project to try out new ideas and test all framework features and modules.
4
star
31

moleculer-agent

🚦 [PoC] Agent to control your Moleculer nodes remotely
JavaScript
4
star
32

moleculer-db-adapter-macrometa

MacroMeta adapter for Moleculer DB service.
JavaScript
4
star
33

moleculer-web-addons

Mixin & middleware addons for official Moleculer API Gateway service.
3
star
34

sandbox-moleculer-api-routing

Moleculer API Gateway routing sandbox on Codesandbox.io
JavaScript
3
star
35

moleculer-appsignal

[WIP] Moleculer Metrics reporter and Tracing exporter for AppSignal
JavaScript
3
star
36

rfcs

Request-For-Comments collection for Moleculer microservices framework
2
star
37

moleculer-template-addon

πŸŽ“ Addon template for moleculer-addons package
JavaScript
2
star
38

moleculer-template-module

πŸŽ“ Simple module template for moleculer-cli
JavaScript
2
star
39

project-typescript-demo

Demo Project. Generated by official "project-typescript" template
TypeScript
2
star
40

moleculer-middlewares

Middleware Monorepo for MoleculerJS
TypeScript
1
star
41

generator-moleculer

Yeoman generator to generate a Moleculer project
JavaScript
1
star
42

katacoda-scenarios

Katacoda scenarios for Moleculer microservices framework
1
star
43

sandbox-moleculer-project

Moleculer project sandbox for prototyping on CodeSandbox.io
JavaScript
1
star