@weave-js/web

0.12.0 • Public • Published

@weave-js/web

A Web Gateway for weave microservice architectures.

Build Status NPM Version Build Status Downloads

Features

  • 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

Install

npm install @weave-js/web

Usage

Run with default settings

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

Documentation

Please read our documentation on weave site

Readme

Keywords

none

Package Sidebar

Install

npm i @weave-js/web

Weekly Downloads

123

Version

0.12.0

License

MIT

Unpacked Size

294 kB

Total Files

58

Last publish

Collaborators

  • fachw3rk