Giter VIP home page Giter VIP logo

node-server-skeleton's People

Contributors

avaq avatar beanow avatar markelog avatar mickvangelderen avatar mtricht avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-server-skeleton's Issues

Terminology service, util, bootstrap

Particularly bootstrap is very ambiguous an currently serves a conflicting purpose with the /services directory.

The main activities in bootstrap right now are:

  • Adding services to the momi state.
  • Generating monads that embody the app runtime.

These are basically ordered IoC resolution instructions.
Perhaps this would be better named /di, /ioc or /providers.

Meanwhile /services doesn't provide the actual services in all cases.
For example /bootstrap/app.js provides the app service, but is not in /services.
While /bootstrap/token.js provides the token service, but is exposed by /services/token.js as two functions rather than the factory-style object creation that is eventually done in bootstrap.

Having the factory part of things delegated to bootstrap makes the distinction between /services and /util very small. The main distinction being whether you're allowed to directly require them or should use the service locater pattern.

Now consider this use case.
An application wants to use port binding as it's access control mechanism.
Say 9000 for it's read API endpoints.
And 9001 for it's write API endpoints.

In the current setup you would end up with a lot of duplication of the /bootstrap/app.js, /bootstrap/http.js and /bootstrap/https.js code.
I believe this may justify a /factories directory and include putFactory & getFactory methods similar to the service location setup.

My initial proposition would be:

  • /providers - the bootstrap replacement, may add services or factories to the state, and generate monads.
  • /factories - dedicated factories folder to make DRY providers
  • /services - the services that will be loaded as-is
  • /util - code that is impractical to offer through services
  • โŒ bootstrap.js - this virtual means the same thing as index.js so I think index.js will serve this purpose just fine.
  • index.js - will do the "bootstrapping" of all the providers

Sessions expire even with user activity

The only way to extend a session is to refresh the authorization token using a refresh token. However, it is good practice for a client only to store the refresh token if the user opted to be remembered on the client. When the authorization token expires without the client being allowed to refresh it, the session may expire while the user is in the middle of something.

Allowing sessions to be arbitrarily extended using just the authorization token is problematic though, as it would defeat the point of not storing refresh tokens.

Add a proper logger

One that could replace the use of debug and util.log and have adapters for logging into the cloud.

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.