Skip to content

weave-microservices/weave-web

Repository files navigation

@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

About

Web API Gateway mixing for weave framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published