ChromaticHQ / jsonmonger

23 stars 1 forks source link

Create a singleton object for shared resources and model registration #1

Closed agarzola closed 6 years ago

agarzola commented 6 years ago

A developer should be able to register configuration such as the API’s base URL in a single place and jsonmonger should use that information when needed. The best solution for this is to create a singleton object that keeps a canonical configuration object with this information.

This object should also be used for registering every custom Model per-type, so that related records can be automagically included as Model objects.

Ref: https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/

agarzola commented 6 years ago

This is implemented as two separate global objects in commits d1b22eefbe and 5c87e5ee16.