1 | HAPI Application Server
|
2 | ========================================
|
3 |
|
4 | HAPI server to ease the creation and integration of applications that consume the HAPI API.
|
5 |
|
6 | This is used by HAPI.App to server up HAPI applications.
|
7 |
|
8 | Installation
|
9 | ----------------------------------------
|
10 |
|
11 | DO NOT INSTALL NPM DIRECTLY! THIS IS JUST USED BY HAPI.APP!
|
12 |
|
13 | Custom MiddleWares for Express.
|
14 | ----------------------------------------
|
15 |
|
16 | You can specify custom middlewares to be used in the application server by creating an `app.server.config.json` file in the folder from where you start the server.
|
17 | The file must contain an array of paths to middleware modules.
|
18 |
|
19 | e.g.
|
20 |
|
21 | ```json
|
22 | [
|
23 | "tamperMW",
|
24 | "./mw/yourMiddleWare"
|
25 | ]
|
26 | ```
|
27 |
|
28 | We provide a set of default modules which you can find in `src/modules`. To use these default modules you just need to specify their name (without the extension) as they appear in the `src/modules` folder.
|
29 |
|
30 | By default the application will use the modules specified in the `default.app.server.config.json` file in the root of this repo.
|
31 |
|
32 | Be aware that the order in which the modules are specified in the config file is meaningful. The application will load them in sequence.
|
33 |
|
34 | Custom middlewares need to implement a specific interface which exposes the following method:
|
35 |
|
36 | ```coffeescript
|
37 | configure: ({app: app, callback: callback}) ->
|
38 | ```
|