https://github.com/moleculerjs/moleculer-web
:earth_africa: Official API Gateway service for Moleculer framework
https://github.com/moleculerjs/moleculer-web
api-gateway gateway hacktoberfest http-server microservices moleculer
Last synced: about 1 month ago
JSON representation
:earth_africa: Official API Gateway service for Moleculer framework
- Host: GitHub
- URL: https://github.com/moleculerjs/moleculer-web
- Owner: moleculerjs
- License: mit
- Created: 2017-05-05T19:14:19.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-31T15:18:00.000Z (about 1 year ago)
- Last Synced: 2024-04-14T07:51:46.337Z (about 1 year ago)
- Topics: api-gateway, gateway, hacktoberfest, http-server, microservices, moleculer
- Language: JavaScript
- Homepage: http://moleculer.services/docs/moleculer-web.html
- Size: 3.05 MB
- Stars: 292
- Watchers: 16
- Forks: 120
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-moleculer - moleculer-web - Official API Gateway service. (Services / Gateway)
README
[](https://github.com/moleculerjs/moleculer)

[](https://coveralls.io/github/moleculerjs/moleculer-web?branch=master)
[](https://www.codacy.com/app/mereg-norbert/moleculer-web?utm_source=github.com&utm_medium=referral&utm_content=moleculerjs/moleculer-web&utm_campaign=Badge_Grade)
[](https://codeclimate.com/github/moleculerjs/moleculer-web/maintainability)
[](https://david-dm.org/moleculerjs/moleculer-web)
[](https://snyk.io/test/github/moleculerjs/moleculer-web)
[](https://gitter.im/moleculerjs/moleculer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)# Official API Gateway for Moleculer framework [](https://www.npmjs.com/package/moleculer-web)
The `moleculer-web` is the official API gateway service for [Moleculer](https://github.com/moleculerjs/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/````js
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](http://moleculer.services/docs/moleculer-web.html)## Test
```
$ npm test
```In development with watching
```
$ npm run ci
```## License
Moleculer-web is available under the [MIT license](https://tldrlegal.com/license/mit-license).## Contact
Copyright (c) 2016-2021 MoleculerJS[](https://github.com/moleculerjs) [](https://twitter.com/MoleculerJS)