A Web Gateway for weave microservice architectures.
- serve static files
- support HTTP & HTTPS
- HTTP2
- Routing
- Support for global and route level middlewares
- alias names (with named parameters & REST shorthand)
- whitelist
- multiple body parsers (json, urlencoded)
- CORS headers
- ETags
- Rate limiter
- before & after call hooks
- Buffer & Stream handling
- middleware mode (use as a middleware in ExpressJS Application)
- support authorization
npm install @weave-js/web
This example uses API Gateway service with default settings.
You can access to all services (including internal $node
services) via http://localhost:3000/
let { Weave } = require('@weave-js/core')
let ApiMixin = require('@weave-js/web')
let broker = new Weave({ logger: console })
// Create a service
broker.createService({
name: 'test',
actions: {
hello() {
return 'Hello API Gateway!'
}
}
})
// Load API Gateway
broker.createService(ApiMixin)
// 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
Please read our documentation on weave site