npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@greenrenge/moleculer-api

v0.3.12

Published

A dynamic API Gateway for MoleculerJS which updates REST endpoints and aggregated GraphQL schema, access control policy for each action calls from metadata of remote services schema without restart or deployment.

Downloads

7

Readme

Introduction

API Gateway

moleculer-api

A dynamic API Gateway which updates REST endpoints, GraphQL schema, Websocket handlers and access control policies by integrating metadata of discovered remote services.

Build Status Coverage Status David Known Vulnerabilities NPM version Moleculer

Moleculer API Gateway는 분산 서비스 환경에서 동적으로 마이크로 서비스들의 API 스키마를 수집하고 조합하며 무중단으로 API를 제공하는 웹 서버 모듈입니다.

서비스 API 스키마는 분산 서비스의 프로시저(이하 액션)의 호출(call)이나 중앙 메시징 서비스에 대한 이벤트 발행(publish) 및 구독(subscribe)을 웹 기반 프로토콜(REST, GraphQL, WebSocket 지원)의 엔드포인트에 맵핑합니다. 서비스 API 스키마는 단일한 JSON 포맷으로 구성되어있으며 각 맵핑에 대한 접근 제어 정책을 포함 할 수 있습니다.

서비스 API 스키마가 제거, 수정, 추가되면 Gateway는 기존 통합 API 스키마에 병합을 시도하고 성공시 무중단으로 라우터를 업데이트하며 그 결과 메시지를 원격 서비스에 다시 보고합니다.

Features

  • 분산 서비스의 API 스키마를 수집하고 병합하여 API를 실시간으로 업데이트
  • 개발 편의를 위한 브랜치 및 태그
  • 상태 검사 및 문서 생성
    • API Gateway 상태 검사
    • API 엔드포인트별 상태 검사
    • API 엔드포인트별 설명, 파라미터, 접근 제어 정보 생성
    • 분산 서비스 액션 및 이벤트 구독, 발행 정보 생성
  • 확장 가능한 웹 서버 구성
    • Cookie/Body Parser
    • ETag
    • CORS
    • HTTP/2
    • TLS
  • 미들웨어 방식의 컨텍스트 생성
    • 인증
    • Locale
  • 프로토콜 플러그인 (핸들러 및 스키마 확장)
    • REST
    • GraphQL
    • WebSocket (TODO)
  • 접근 제어 정책 플러그인 (핸들러 및 스키마 확장)

How to use

// math.service.js
module.exports = {
  name: 'math',
  metadata: {
    api: {
      branch: 'master',
      policy: {
        call: [
          {
            actions: ['math.action.authorization'],
            description: 'Unauthorized',
            scope: ['sports'],
            filter: `({ context, params }) => {
              if (test authorization here) {
                return true;
              }
              return false;
            }`,
          },
          {
            actions: ['math.action.*'],
            description: 'Authentication required',
            protected: true,
          },
        ],
      },
      protocol: {
        GraphQL: Schema,
      },
    },
  },
  actions: {
    "action": {
      parmas: {
        ...
      },
      async handler({ params }) {
      }
    },
    "action.authorization": {
      parmas: {
        ...
      },
      async handler({ params }) {
      }
    },
  },
};

Development

1. Yarn Scripts

  • yarn dev [example=simple] - Start development (nodemon with ts-node)
  • yarn build- Uses typescript to transpile service to javascript
  • yarn lint - Run TSLint
  • yarn test - Run tests & generate coverage report
  • yarn test --watch - Watch and run tests

Contribution

Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.

License

The project is available under the MIT license.

Contact

Copyright (c) 2019 QMIT Inc.