All Projects → dimapaloskin → dev-gateway

dimapaloskin / dev-gateway

Licence: MIT License
Local development cluster with "now" path aliases syntax support. Allows running multiple microservices as one solid server.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dev-gateway

Azure-AKS-ApplicationGateway-WAF
No description or website provided.
Stars: ✭ 16 (-50%)
Mutual labels:  cluster, gateway
Micro Medium Api
Microservice for fetching the latest posts of Medium with GraphQL.
Stars: ✭ 138 (+331.25%)
Mutual labels:  now, micro
Micro Starter Kit
Cloud Native GoLang Microservices - gRPC, GraphQL
Stars: ✭ 167 (+421.88%)
Mutual labels:  gateway, micro
Micro Cluster
Run multiple micro servers and a front proxy at a time
Stars: ✭ 173 (+440.63%)
Mutual labels:  cluster, micro
prismy
🌈 Simple and fast type safe server library for now.sh v2 and API routes of next.js.
Stars: ✭ 46 (+43.75%)
Mutual labels:  now, micro
Temps
λ A selfhostable serverless function runtime. Inspired by zeit now.
Stars: ✭ 15 (-53.12%)
Mutual labels:  cluster, now
s3-example
Simple example using micro for uploading stuff to AWS S3.
Stars: ✭ 45 (+40.63%)
Mutual labels:  now, micro
hooked
Microservice for communicating between Contentful and Shopify
Stars: ✭ 17 (-46.87%)
Mutual labels:  now, micro
ipns-link
Expose local http-server (web-app) through IPNS
Stars: ✭ 18 (-43.75%)
Mutual labels:  gateway
apisix-java-plugin-runner
APISIX Plugin Runner in Java
Stars: ✭ 57 (+78.13%)
Mutual labels:  gateway
magento-2-sample-payment-method
Magento 2 Create Payment Method proves that store admin has rights to generate as many payment methods as they need when your store is based on Magento 2 platform, an great era of ecommerce architecture. Depending on the customer's requirement, you probably plug it in your list of the existing payment method. The additional payment methods surel…
Stars: ✭ 53 (+65.63%)
Mutual labels:  gateway
protoc-gen-micro
Protobuf code generation
Stars: ✭ 287 (+796.88%)
Mutual labels:  micro
init ec2
init EC2 cluster, for free-password-login(ubuntu and root). for hostname, for hosts file.
Stars: ✭ 11 (-65.62%)
Mutual labels:  cluster
core
augejs is a progressive Node.js framework for building applications. https://github.com/augejs/augejs.github.io
Stars: ✭ 18 (-43.75%)
Mutual labels:  cluster
php-ipg-ir
IPG (Internet Payment Gateway) manager for Iran Banking System
Stars: ✭ 26 (-18.75%)
Mutual labels:  gateway
docker-rabbitmq-ha-cluster
A docker stack to create, test and benchmark a rabbitmq cluster in high availability configuration. HAProxy, php workers, node failures, network partition, persistent messages.
Stars: ✭ 98 (+206.25%)
Mutual labels:  cluster
typedash
🚀 2KB lodash in typescript
Stars: ✭ 26 (-18.75%)
Mutual labels:  micro
couper
Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects
Stars: ✭ 60 (+87.5%)
Mutual labels:  gateway
lightify-binary-protocol
Documentation of the OSRAM Lightify Binary Protocol for communication between Lightify Gateway and applications
Stars: ✭ 26 (-18.75%)
Mutual labels:  gateway
dlaCluster
Python code for simple diffusion limited aggregation (DLA) simulation. The code provided creates a .gif for cluster growth and calculates fractal dimensionality of the cluster. User can vary the radius of the cluster.
Stars: ✭ 23 (-28.12%)
Mutual labels:  cluster

dev-gateway

Local development cluster with now path aliases syntax support. Allows running multiple microservices as one solid server.

Build Status XO code style Greenkeeper badge

Installation

npm install --save-dev dev-gateway
# or
yarn add -D dev-gateway

Usage

At first, you need to create app.js file and define configuration:

module.exports = {
  port: 3000,
  host: 'localhost',
  rules: [{
    slug: 'auth',
    pathname: '/api/auth/**',
    dest: 'auth.api.localhost',
    run: 'micro index.js',
    cwd: './auth',
    env: {
      SECRET_TOKEN: 'kittens'
    },
    debug: true
  }, {
    slug: 'accounts',
    pathname: '/api/accounts',
    dest: 'accounts.api.localhost',
    method: ['GET', 'POST'],
    run: 'cd ./accounts && micro index.js',
    debug: true
  }, {
    pathname: '/api/entries/*',
    dest: 'entries.api.localhost',
    run: 'cd ./entries && micro index.js',
    debug: true
  }, {
    pathname: '/proxy',
    dest: 'proxy.api.localhost',
    proxy: 'https://first.pong.world/any/path'
  }]
}

The next step is to add a new script to your package.json:

{
  "scripts": {
    "dev": "dev-gateway serve app.js"
  }
}

Then run:

npm run dev

Rules

Rules access the following parametres:

  • slug - slug, just a name of rule
  • pathname - pathname alias; has similar wildcard syntax to this one now path aliases
  • dest - destination host. Microservice will be available if you send request directly to the host.
  • method - string or array. To specify allowed methods.
  • run - shell command to run your microservice.
  • port - port used by microservice. Gateway will try to detect opened port if these parametres are not defined.
  • proxy - url. All requests will be proxied to this url if parameter is defined.
  • debug - boolean or object ({ stdout: false, stderr: true}). Gateway will pipe microservice output to the terminal, if 'debug' is true.
  • env - the parameter is used to define environment variables for a microservice.
  • logFile - will pipe stdout and stderr to a specified file.
  • cwd - rule's working directory
  • maxGetPortAttempts - number of attempts to obtain a rule's port. Each attempt waits for 1 second. E.g. set maxGetPortAttempts to 30 to wait for 30 seconds before a rule is marked as "not available". Defaults to 10.
  • startTimeout - timeout (in ms) before start port checking (useful for long starting apps)

Cli

Run:

dev-gateway serve app.js -p 3000 -h localhost
  • -p, --port - port
  • -h, --host - host
  • -S, --skip - skip whole rule by slug
  • -s, --skip-run - skip running stage by slug (it can be useful if you want to run microservice manually, but you still needed requests proxying)

Extract:

dev-gateway extract app.js --dest example.com --output rules.json

Will extract current configuration to rules.json file

  • -d, --dest - destination
  • -o, --output - output file with rules

In action

Clone this repo and run:

npm install
npm run example

You can check test server in the test/example directory.

Alternatives

  • serve-micro-cluster - Easily start a local cluster of micro-based services using a simple rules.json file. It's like Path Alias on now, but for local development.
  • micro-cluster - Run multiple micro servers and a front proxy at a time, with a simple configuration file.

Author

Dmitry Pavlovsky

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].