GithubHelp home page GithubHelp logo

muenalan / moleculer-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moleculerjs/moleculer-web

0.0 2.0 0.0 1.47 MB

:earth_africa: Official API Gateway service for Moleculer framework

Home Page: http://moleculer.services/docs/moleculer-web.html

License: MIT License

JavaScript 99.73% HTML 0.27%

moleculer-web's Introduction

Moleculer logo

Build Status Coverage Status Codacy Badge Maintainability David Known Vulnerabilities Join the chat at https://gitter.im/moleculerjs/moleculer

Official API Gateway for Moleculer framework NPM version

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
  • alias names (with named parameters & REST shorthand)
  • whitelist
  • multiple body parsers (json, urlencoded)
  • CORS headers
  • 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.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

Test

$ npm test

In development with watching

$ npm run ci

License

Moleculer-web is available under the MIT license.

Contact

Copyright (c) 2016-2017 MoleculerJS

@moleculerjs @MoleculerJS

moleculer-web's People

Contributors

icebob avatar molobala avatar millimoose avatar felipegcampos avatar hwuethrich avatar rmccallum81 avatar snyk-bot avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.