https://github.com/jaredhanson/node-servicelocator
Central location to register and locate services within a Node.js application.
https://github.com/jaredhanson/node-servicelocator
Last synced: about 1 year ago
JSON representation
Central location to register and locate services within a Node.js application.
- Host: GitHub
- URL: https://github.com/jaredhanson/node-servicelocator
- Owner: jaredhanson
- License: mit
- Created: 2013-08-08T19:20:59.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-08-08T19:49:28.000Z (almost 13 years ago)
- Last Synced: 2025-05-13T01:52:35.486Z (about 1 year ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# servicelocator
[](http://travis-ci.org/jaredhanson/node-servicelocator)
[](https://coveralls.io/r/jaredhanson/node-servicelocator)
[](http://david-dm.org/jaredhanson/node-servicelocator)
A central location to register and locate services within a Node.js application.
This module implements the [service locator pattern](http://en.wikipedia.org/wiki/Service_locator_pattern),
as [detailed](http://martinfowler.com/articles/injection.html) by
[Martin Fowler](http://martinfowler.com/).
## Install
$ npm install servicelocator
## Usage
#### Register a Service
```javascript
var locator = require('servicelocator');
locator.register('db', dbConnection);
```
#### Get a Service
```javascript
var locator = require('servicelocator');
var dbConnection = locator.get('db');
```
## Related Modules
- [notifications](https://github.com/jaredhanson/node-notifications) — a mechanism for dispatching notifications
## Tests
$ npm install
$ npm test
## Credits
- [Jared Hanson](http://github.com/jaredhanson)
## License
[The MIT License](http://opensource.org/licenses/MIT)
Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>