@modernpoacher/halacious 7.0.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/examples/api-root.cjs +0 -89
- package/examples/array-of-links.cjs +0 -68
- package/examples/auto-namespace.cjs +0 -48
- package/examples/functional-href.cjs +0 -67
- package/examples/hello-world.cjs +0 -25
- package/examples/manual-namespace.cjs +0 -52
- package/examples/media-types.cjs +0 -44
- package/examples/paging.cjs +0 -88
- package/examples/programmatic-entity.cjs +0 -60
- package/examples/programmatic-route.cjs +0 -60
- package/examples/query-string.cjs +0 -53
- package/examples/rels/mycompany/boss.md +0 -1
- package/examples/rels/mycompany/user.md +0 -7
- package/examples/rels/mycompany/users.md +0 -1
- package/examples/simple-embed.cjs +0 -44
- package/examples/simple-link.cjs +0 -39
- package/test/plugin.spec.mjs +0 -2605
- package/test/rels/mycompany/boss.md +0 -2
- package/test/rels/mycompany/employee.md +0 -2
- package/test/representation.spec.mjs +0 -384
- package/tsconfig.json +0 -11
- package/views/namespaces.jade +0 -11
- package/views/rel.jade +0 -7
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const hapi = require('@hapi/hapi')
|
|
2
|
-
const vision = require('@hapi/vision')
|
|
3
|
-
const halacious = require('#halacious')
|
|
4
|
-
|
|
5
|
-
async function init () {
|
|
6
|
-
const server = hapi.server({ port: 8080 })
|
|
7
|
-
|
|
8
|
-
await server.register(vision)
|
|
9
|
-
|
|
10
|
-
await server.register({ plugin: halacious, options: { absolute: true } })
|
|
11
|
-
|
|
12
|
-
server.route({
|
|
13
|
-
method: 'get',
|
|
14
|
-
path: '/users/{userId}',
|
|
15
|
-
handler (req) {
|
|
16
|
-
return {
|
|
17
|
-
id: req.params.userId,
|
|
18
|
-
name: `User ${req.params.userId}`,
|
|
19
|
-
boss: {
|
|
20
|
-
id: 1234,
|
|
21
|
-
name: 'Boss Man'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
config: {
|
|
26
|
-
plugins: {
|
|
27
|
-
hal: {
|
|
28
|
-
embedded: {
|
|
29
|
-
boss: {
|
|
30
|
-
path: 'boss', // the property name of the object to embed
|
|
31
|
-
href: '../{item.id}'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
await server.start()
|
|
40
|
-
|
|
41
|
-
console.log('Server started at %s', server.info.uri)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
init()
|
package/examples/simple-link.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const hapi = require('@hapi/hapi')
|
|
2
|
-
const vision = require('@hapi/vision')
|
|
3
|
-
const halacious = require('#halacious')
|
|
4
|
-
|
|
5
|
-
async function init () {
|
|
6
|
-
const server = hapi.server({ port: 8080 })
|
|
7
|
-
|
|
8
|
-
await server.register(vision)
|
|
9
|
-
|
|
10
|
-
await server.register(halacious)
|
|
11
|
-
|
|
12
|
-
server.route({
|
|
13
|
-
method: 'get',
|
|
14
|
-
path: '/users/{userId}',
|
|
15
|
-
handler (req) {
|
|
16
|
-
return {
|
|
17
|
-
id: req.params.userId,
|
|
18
|
-
name: `User ${req.params.userId}`,
|
|
19
|
-
googlePlusId: '107835557095464780852'
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
config: {
|
|
23
|
-
plugins: {
|
|
24
|
-
hal: {
|
|
25
|
-
links: {
|
|
26
|
-
home: 'http://plus.google.com/{googlePlusId}'
|
|
27
|
-
},
|
|
28
|
-
ignore: 'googlePlusId' // remove the id property from the response
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
await server.start()
|
|
35
|
-
|
|
36
|
-
console.log('Server started at %s', server.info.uri)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
init()
|