Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 1e4a5ea

Browse files
committed
Update http-fake-backend to v3.0.6
1 parent 8bf28ef commit 1e4a5ea

File tree

3 files changed

+36
-34
lines changed

3 files changed

+36
-34
lines changed

generators/app/templates/README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,26 @@ Each endpoint needs a configuration file in `/server/api/` to define routes, htt
8181
```js
8282
module.exports = SetupEndpoint({
8383
name: 'articles',
84-
urls: [
85-
{
86-
params: '/{filter}/{offset}/{items}',
87-
requests: [{
88-
method: 'GET',
89-
response: '/json-templates/articles.json'
90-
}]
91-
},
92-
{
93-
params: '/update',
94-
requests: [{
95-
method: 'PATCH',
96-
response: { patch: true }
97-
},{
98-
method: 'PUT',
99-
response: { put: true }
100-
}]
101-
}
102-
],
84+
urls: [{
85+
params: '/{filter}/{offset}/{items}',
86+
requests: [{
87+
method: 'GET',
88+
response: '/json-templates/articles.json'
89+
}]
90+
}, {
91+
params: '/update',
92+
requests: [{
93+
method: ['PUT', 'PATCH'],
94+
response: {
95+
success: true
96+
}
97+
}, {
98+
method: 'DELETE',
99+
response: {
100+
deleted: true
101+
}
102+
}]
103+
}],
103104
statusCode: 505
104105
});
105106
```
@@ -116,12 +117,13 @@ The configuration object in Detail:
116117
`http://localhost:8081/api/articles/foo/bar/baz`
117118
whereas:
118119
`http://localhost:8081/api/articles` will return a 404 error.
119-
* See hapi docs regarding [path parameters](http://hapijs.com/api#path-parameters).
120+
* See hapi docs. For example regarding optional [path parameters](http://hapijs.com/api#path-parameters).
120121
* `urls.requests`
121122
* You need to add at least one request object.
122123
* `urls.requests.method`
123124
* optional. Uses `GET` when not defined.
124-
* is used to define the http method to which the endpoint will listen.
125+
* `string`, or `array` of strings.
126+
* is used to define the http method(s) to which the endpoint will listen.
125127
* `urls.requests.response`
126128
* Could be a string pointing to a JSON template:
127129
* `response: '/json-templates/articles.json'`

generators/app/templates/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-fake-backend",
3-
"version": "3.0.5",
3+
"version": "3.0.6",
44
"description": "Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.",
55
"license": "MIT",
66
"main": "index.js",
@@ -19,27 +19,27 @@
1919
"node": ">=4.0.0"
2020
},
2121
"dependencies": {
22-
"boom": "^3.2.1",
22+
"boom": "^4.0.0",
2323
"confidence": "^3.x.x",
2424
"dotenv": "^2.0.0",
2525
"glue": "^3.x.x",
26-
"good": "^7.0.1",
26+
"good": "^7.0.2",
2727
"good-console": "^6.1.2",
2828
"good-squeeze": "^4.0.0",
2929
"handlebars": "^4.0.5",
30-
"hapi": "^13.x.x",
31-
"inert": "^4.0.0",
30+
"hapi": "^15.x.x",
31+
"inert": "^4.0.2",
3232
"require-dir": "^0.3.0",
3333
"vision": "^4.x.x",
3434
"visionary": "^6.x.x"
3535
},
3636
"devDependencies": {
37-
"code": "^3.0.1",
38-
"coveralls": "^2.11.9",
39-
"eslint": "^2.13.0",
40-
"eslint-config-hapi": "^9.1.0",
37+
"code": "^3.0.2",
38+
"coveralls": "^2.11.12",
39+
"eslint": "^3.4.0",
40+
"eslint-config-hapi": "^10.0.0",
4141
"eslint-plugin-hapi": "^4.0.0",
42-
"lab": "^10.x.x",
42+
"lab": "^11.x.x",
4343
"nodemon": "^1.x.x"
4444
}
4545
}

generators/app/templates/server/api/setup/setup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function (settings) {
2121

2222
const method = action.method || 'GET';
2323
const supportedMethod = {
24-
method: method,
24+
method,
2525
path: path + params,
2626
handler: function (request, reply) {
2727

@@ -76,8 +76,8 @@ module.exports = function (settings) {
7676

7777
exportEndpoint.register.attributes = {
7878
name: settings.name,
79-
path: path,
80-
urls: urls
79+
path,
80+
urls
8181
};
8282

8383
return exportEndpoint;

0 commit comments

Comments
 (0)