1
- var Hapi = require ( 'hapi ' ) ,
2
- Intaglio = require ( 'intaglio ' ) ;
1
+ var Intaglio = require ( 'intaglio ' ) ,
2
+ serializer = require ( '../serializers/hal ' ) ;
3
3
4
- module . exports = function ( orm , host , port , serializer , options ) {
4
+ module . exports = function ( orm , plugin ) {
5
5
Intaglio . utils . assert ( '`orm` is required!' , orm !== undefined ) ;
6
- Intaglio . utils . assert ( '`host` is required!' , host !== undefined ) ;
7
- Intaglio . utils . assert ( '`port` is required!' , port !== undefined ) ;
8
- Intaglio . utils . assert ( '`serializer` is required!' , serializer !== undefined ) ;
6
+ Intaglio . utils . assert ( '`plugin` is required!' , plugin !== undefined ) ;
9
7
10
- var server = Hapi . createServer ( host , port , options ) ,
11
- routes = [
8
+ var routes = [
12
9
{
13
10
path : '/api/{model}/{id?}' ,
14
11
method : 'GET' ,
@@ -62,7 +59,7 @@ module.exports = function (orm, host, port, serializer, options) {
62
59
{
63
60
path : '/api' ,
64
61
method : 'GET' ,
65
- handler : require ( './handlers/base' ) ( orm , serializer )
62
+ handler : require ( './handlers/base' ) ( orm )
66
63
} ,
67
64
{
68
65
path : '/schema' ,
@@ -71,7 +68,7 @@ module.exports = function (orm, host, port, serializer, options) {
71
68
}
72
69
] ;
73
70
74
- server . route ( routes ) ;
71
+ plugin . route ( routes ) ;
75
72
76
- return server ;
73
+ return plugin ;
77
74
} ;
0 commit comments