Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Wolf committed Feb 5, 2016
1 parent b9e06e2 commit 5403518
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ exports.init = function(app) {
Services do most of the heavy lifting. Like handlers, services contain init functions that are called during server startup.
However, services can export other functions, and those functions can be invoked from handlers.

Here's an example of a fizzbuzz service (services/fizzbuzz.js).
You'll notice it has an init method with two parameters, logger and callback.
The logger is a built in service.
And callback is an optional parameter that can be used for cases where services need to perform asynchronous operations during startup.
The service also exports a _getResult_ function. Any service or handler with a dependency on _fizzbuzz_ can invoke `fizzbuzz.getResult`.
Here's an example of a fizzbuzz service (services/fizzbuzz.js). You'll notice it has an init method with two parameters, logger and callback. The logger is a built-in service. The _callback_ is an optional parameter used for cases where services need to perform asynchronous operations during startup. The service also exports a _getResult_ function. Any service or handler with a dependency on _fizzbuzz_ can invoke `fizzbuzz.getResult`.

```js
exports.init = function(logger, callback) {
Expand All @@ -67,7 +63,7 @@ exports.getResult = function(num) {

```

We want to use that service from our handler, so we simply include `fizzbuzz` as a parameter of the `init` function.
We want to use that service from our handler, so we include `fizzbuzz` as a parameter of the `init` function.
The server will ensure that the fizzbuzz service is initialized during server startup and passed to the handler.

```js
Expand Down

0 comments on commit 5403518

Please sign in to comment.