GithubHelp home page GithubHelp logo

bfx-lib-server-js's Introduction

bfx-lib-server-js

Module for shared server logic used by our the express server in our Single Page Applications (SPAs)

bfx-lib-server-js's People

Contributors

batrudinych avatar davide-scola avatar ezewer avatar face avatar grantfayvor avatar prdn avatar robertkowalski avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

bfx-lib-server-js's Issues

getGrenacheReqWithIp improvements

When writing a server where some arguments come from the server itself (e.g. a config file), getGrenacheReqWithIp requires monkey patching the request object.

Example from moonbeam:

  _getAuthToken (req, user, cb) {
    const service = 'rest:core:user'
    const request = getGrenacheReqWithIp('getAuthToken', service)

    req.body.user = user
    request(req, {
      json: (data) => {
        if (!data.success) {
          if (data.message.startsWith('connect ECONNREFUSED') ||
            data.message.startsWith('ERR_GRAPE_LOOKUP_EMPTY')) {
            log(data)
            return cb(new Error('ERR_AUTH_BACKEND'))
          }

          return cb(new Error('ERR_AUTH'))
        }

        cb(null, data.data)
      }
    })
  }

Possible solutions:

  1. allow optional arguments as parameter for getGrenacheReqWithIp
  2. add another method which does not interact with the request object

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.