项目
在 GitHub 查看
Official API Gateway for Moleculer framework
moleculerjs/moleculer-web
关于
🌍 Moleculer 框架的官方 API 网关服务
系统与基础设施可以做什么
- support HTTP & HTTPS
- serve static files
- multiple routes
- support global, route, alias middlewares
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Official API Gateway for Moleculer framework 
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
- blacklist
- 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.helloaction:http://localhost:3000/test/helloGet health info of node:
http://localhost:3000/~node/healthList 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-2026 MoleculerJS
探索相关项目
加载中…
