Git Product home page Git Product logo

hydra-express's Introduction

logo

npm version NPM downloads

Hydra-Express is a light-weight library for building NodeJS and ExpressJS based distributed computing applications. It was announced at EmpireNode 2016.

Hydra offers features such as service discovery, distributed messaging, message load balancing, logging, presence, and health monitoring.

See our quick start guide

Using Hapi, Koa, Sails.js, Restify or Restana then checkout the Hydra Integration Project.

Documentation

We're building a dedicated documentation site for hydra at: https://www.hydramicroservice.com Our older docs are still available at: Full documentation

Interested in running Hydra-express on AWS using Docker containers and Swarm mode? See: https://github.com/cjus/hydra-and-aws-in-docker-swarm

Join us on Slack!

Are you using or planning on using Hydra on your project? Join us on Slack for more direct support. https://fwsp-hydra.slack.com To join, email [email protected] with your desired username and email address (for invite).

Related projects

There are many projects on NPM which contain the name hydra. The following are official projects related to the Hydra - microservice library.

  • Hydra: hydra core project for use with Non-ExpressJS apps
  • Hydra-Express: hydra for ExpressJS developers
  • Hydra-Integration: Integrating third-party Node.js web frameworks with Hydra
  • Hydra-Router: A service-aware socket and HTTP API router
  • Hydra-cli: a hydra commandline client for interacting with Hydra-enabled applications
  • Hydra Generator: A Yeoman generator for quickly building hydra-based projects
  • Hydra-plugin-rpc: Create and consume remote procedure calls in hydra with ease
  • Hydra-Cluster: A compute cluster based on Hydra
  • UMF: Universal Message Format, a messaging specification for routable messages

Articles

hydra-express's People

Contributors

cjus avatar emadum avatar gitter-badger avatar jeldalam avatar taurenk avatar tomascasas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hydra-express's Issues

Remove deprecated usage of Bunyan

These entries in the package.json files and any related code in index.js

     "bunyan": "1.8.4",
    "bunyan-loggly": "1.1.0",
    "bunyan-logstash-tcp": "0.3.4",
    "bunyan-prettystream": "0.1.3",

Unable to run test cases

Getting this error....Need some sample test cases pls. Really tried to delete node_modules and installed again as suggested in forums and didnt work out..Got stucked with this..

C:\Hackathon\Samaritan\dashboard-service>npm test

[email protected] test C:\Hackathon\Samaritan\dashboard-service
mocha specs --reporter spec

C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:1163
else throw err
^

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
at Module.require (internal/modules/cjs/loader.js:631:11)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (C:\Hackathon\Samaritan\dashboard-service\specs\test.js:22:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:330:36
at Array.forEach ()
at Mocha.loadFiles (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:327:14)
at Mocha.run (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:804:10)
at Object.exports.singleRun (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run-helpers.js:207:16)
at exports.runMocha (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run.js:296:3)
at Object.runCommand (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\lib\command.js:242:26)
at Object.parseArgs [as _parseArgs] (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:1087:28)
at Object.parse (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:566:25)
at Object.exports.main (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\cli.js:63:6)
at Object. (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\bin_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm ERR! Test failed. See above for more details.

Redis error when use testMode with true (to use redis-mock)

We opened an issue in hydra project (pnxtech/hydra#207) to know how to disable Redis connection to a small project.

Looking at the hydra documentation I find'd the testMode property and when that property is enabled is possible to use redis-mock. But, when using that enabled property, we receive this error:

node_modules/hydra/index.js:848
              .select(HYDRA_REDIS_DB)
               ^

TypeError: this.redisdb.multi(...).select is not a function

My hydra-express version is 1.5.5

@cjus any idea?

Thanks.

Usage with Node Cluster

Hi,

Thanks for sharing this awesome library!

I'm starting migrating our node cluster application to microservices.
Our app uses express with node cluster, so we have 5+ workers running with express framework.

https://nodejs.org/api/cluster.html

  1. How should I use hydra-express with node cluster module?
  2. I want to use websocket as well, I did not find any examples of hydra with websocket, can hydra handle/route websocket request and server push notifications?

Thank you

Disable CORS

How do I disable the CORS headers completely? In my setup, they are handled at the reverse proxy level instead of at individual service level

I also see that cors plugin is initialized twice at L325 and L389

callback of hydraExpress.init is called 2 times

Hello,

I'm trying this sample, and the callback seems to be called 2 times (it displays 2 ๐Ÿ˜€)

const hydraExpress = require('fwsp-hydra-express');
const config = require('./config.json');

hydraExpress.init(config, () => {
  console.log("๐Ÿ˜€")
  const express = hydraExpress.getExpress();
  const api = express.Router();

  api.get('/', function(req, res) {
    res.send({
      msg: `hello from ${hydra.getServiceName()} - ${hydra.getInstanceID()}`
    });
  });

  hydraExpress.registerRoutes({
    '': api
  });
});

HTTP-StatusCode 403

It seems that hydra can't handle the HTTP-StatusCode 403. Whenever I try to send this status it defaults to 503, which means the service is unavailable (which is not true).
The reason for this seems to be that the key '403' doesn't exist in the ServerResponse.STATUS-object in the server-response.js-file. Therefore the createResponseObject function throws an error (because it tries to access the object at a key that does not exist) and the response defaults to 503 in the catch-block of _tryAPIRequest.

Is there any workaround for this?

ssl configuration

Hi

Looking for ssl configuration with hydra, Is it possible to configure ssl certificates?

body-parser not usable

I'm currently having problems with the use of body-parser, because I'm trying to upload some files that are ~1MB.
Because of the fact, that the bodyParser (specifically the json-parser) is initialized with its default values in the index.js file, the allowed request size is always the default (which is 100KB) and therefore I keep getting "Request Entity Too Large"-Errors. There doesn't seem to be any way to reset this limit inside my own code.
Has anyone had this issue before?

In my opinion, a solution for this issue could be to add the body-parser config parameters to the config.json-file and then take them from there (if present).

Please let me know your thoughts on this.

Use module logging utility

An error in my Node JS application is throwing a hydra-express related exception (and covering up the real issue on my end):

TypeError: this.appLogger.fatal is not a function
    at /usr/src/app/node_modules/hydra-express/index.js:487:26
    at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at param (/usr/src/app/node_modules/express/lib/router/index.js:354:14)
    at param (/usr/src/app/node_modules/express/lib/router/index.js:365:14)

Based on the trace, I believe the culprit is here:

this.appLogger.fatal({
and should use this.log('fatal', {msg}) instead.

We are running with the following dependencies:

  "dependencies": {
    "redis": "2.8.0",
    "hydra-express": "1.8.3",
    "hydra-express-plugin-jwt-simple-auth": "0.1.0",
    "hydra-plugin-hls": "0.2.6",
    "node-fetch": "2.6.1"
  },

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.