Skip to content

Commit 8f4b776

Browse files
committed
Fix route examples
1 parent 6284a07 commit 8f4b776

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

README.md

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ myFoxxApp.post('users', {
751751
username: 'admin',
752752
password: 'hunter2'
753753
})
754-
.then(result => {
755-
// result is the result of
754+
.then(response => {
755+
// response.body is the result of
756756
// POST /_db/_system/my-foxx-app/users
757757
// with JSON request body '{"username": "admin", "password": "hunter2"}'
758758
});
@@ -1116,24 +1116,24 @@ Performs a GET request to the given URL and returns the server response.
11161116
var db = require('arangojs')();
11171117
var route = db.route('my-foxx-app');
11181118
route.get()
1119-
.then(result => {
1120-
// result is the response body of calling
1119+
.then(response => {
1120+
// response.body is the response body of calling
11211121
// GET _db/_system/my-foxx-app
11221122
});
11231123

11241124
// -- or --
11251125

11261126
route.get('users')
1127-
.then(result => {
1128-
// result is the response body of calling
1127+
.then(response => {
1128+
// response.body is the response body of calling
11291129
// GET _db/_system/my-foxx-app/users
11301130
});
11311131

11321132
// -- or --
11331133

11341134
route.get('users', {group: 'admin'})
1135-
.then(result => {
1136-
// result is the response body of calling
1135+
.then(response => {
1136+
// response.body is the response body of calling
11371137
// GET _db/_system/my-foxx-app/users?group=admin
11381138
});
11391139
```
@@ -1164,16 +1164,16 @@ Performs a POST request to the given URL and returns the server response.
11641164
var db = require('arangojs')();
11651165
var route = db.route('my-foxx-app');
11661166
route.post()
1167-
.then(result => {
1168-
// result is the response body of calling
1167+
.then(response => {
1168+
// response.body is the response body of calling
11691169
// POST _db/_system/my-foxx-app
11701170
});
11711171

11721172
// -- or --
11731173

11741174
route.post('users')
1175-
.then(result => {
1176-
// result is the response body of calling
1175+
.then(response => {
1176+
// response.body is the response body of calling
11771177
// POST _db/_system/my-foxx-app/users
11781178
});
11791179

@@ -1183,8 +1183,8 @@ route.post('users', {
11831183
username: 'admin',
11841184
password: 'hunter2'
11851185
})
1186-
.then(result => {
1187-
// result is the response body of calling
1186+
.then(response => {
1187+
// response.body is the response body of calling
11881188
// POST _db/_system/my-foxx-app/users
11891189
// with JSON request body {"username": "admin", "password": "hunter2"}
11901190
});
@@ -1195,8 +1195,8 @@ route.post('users', {
11951195
username: 'admin',
11961196
password: 'hunter2'
11971197
}, {admin: true})
1198-
.then(result => {
1199-
// result is the response body of calling
1198+
.then(response => {
1199+
// response.body is the response body of calling
12001200
// POST _db/_system/my-foxx-app/users?admin=true
12011201
// with JSON request body {"username": "admin", "password": "hunter2"}
12021202
});
@@ -1228,16 +1228,16 @@ Performs a PUT request to the given URL and returns the server response.
12281228
var db = require('arangojs')();
12291229
var route = db.route('my-foxx-app');
12301230
route.put()
1231-
.then(result => {
1232-
// result is the response body of calling
1231+
.then(response => {
1232+
// response.body is the response body of calling
12331233
// PUT _db/_system/my-foxx-app
12341234
});
12351235

12361236
// -- or --
12371237

12381238
route.put('users/admin')
1239-
.then(result => {
1240-
// result is the response body of calling
1239+
.then(response => {
1240+
// response.body is the response body of calling
12411241
// PUT _db/_system/my-foxx-app/users
12421242
});
12431243

@@ -1247,8 +1247,8 @@ route.put('users/admin', {
12471247
username: 'admin',
12481248
password: 'hunter2'
12491249
})
1250-
.then(result => {
1251-
// result is the response body of calling
1250+
.then(response => {
1251+
// response.body is the response body of calling
12521252
// PUT _db/_system/my-foxx-app/users/admin
12531253
// with JSON request body {"username": "admin", "password": "hunter2"}
12541254
});
@@ -1259,8 +1259,8 @@ route.put('users/admin', {
12591259
username: 'admin',
12601260
password: 'hunter2'
12611261
}, {admin: true})
1262-
.then(result => {
1263-
// result is the response body of calling
1262+
.then(response => {
1263+
// response.body is the response body of calling
12641264
// PUT _db/_system/my-foxx-app/users/admin?admin=true
12651265
// with JSON request body {"username": "admin", "password": "hunter2"}
12661266
});
@@ -1292,16 +1292,16 @@ Performs a PATCH request to the given URL and returns the server response.
12921292
var db = require('arangojs')();
12931293
var route = db.route('my-foxx-app');
12941294
route.patch()
1295-
.then(result => {
1296-
// result is the response body of calling
1295+
.then(response => {
1296+
// response.body is the response body of calling
12971297
// PATCH _db/_system/my-foxx-app
12981298
});
12991299

13001300
// -- or --
13011301

13021302
route.patch('users/admin')
1303-
.then(result => {
1304-
// result is the response body of calling
1303+
.then(response => {
1304+
// response.body is the response body of calling
13051305
// PATCH _db/_system/my-foxx-app/users
13061306
});
13071307

@@ -1310,8 +1310,8 @@ route.patch('users/admin')
13101310
route.patch('users/admin', {
13111311
password: 'hunter2'
13121312
})
1313-
.then(result => {
1314-
// result is the response body of calling
1313+
.then(response => {
1314+
// response.body is the response body of calling
13151315
// PATCH _db/_system/my-foxx-app/users/admin
13161316
// with JSON request body {"password": "hunter2"}
13171317
});
@@ -1321,8 +1321,8 @@ route.patch('users/admin', {
13211321
route.patch('users/admin', {
13221322
password: 'hunter2'
13231323
}, {admin: true})
1324-
.then(result => {
1325-
// result is the response body of calling
1324+
.then(response => {
1325+
// response.body is the response body of calling
13261326
// PATCH _db/_system/my-foxx-app/users/admin?admin=true
13271327
// with JSON request body {"password": "hunter2"}
13281328
});
@@ -1350,24 +1350,24 @@ Performs a DELETE request to the given URL and returns the server response.
13501350
var db = require('arangojs')();
13511351
var route = db.route('my-foxx-app');
13521352
route.delete()
1353-
.then(result => {
1354-
// result is the response body of calling
1353+
.then(response => {
1354+
// response.body is the response body of calling
13551355
// DELETE _db/_system/my-foxx-app
13561356
});
13571357

13581358
// -- or --
13591359

13601360
route.delete('users/admin')
1361-
.then(result => {
1362-
// result is the response body of calling
1361+
.then(response => {
1362+
// response.body is the response body of calling
13631363
// DELETE _db/_system/my-foxx-app/users/admin
13641364
});
13651365

13661366
// -- or --
13671367

13681368
route.delete('users/admin', {permanent: true})
1369-
.then(result => {
1370-
// result is the response body of calling
1369+
.then(response => {
1370+
// response.body is the response body of calling
13711371
// DELETE _db/_system/my-foxx-app/users/admin?permanent=true
13721372
});
13731373
```
@@ -1394,8 +1394,7 @@ Performs a HEAD request to the given URL and returns the server response.
13941394
var db = require('arangojs')();
13951395
var route = db.route('my-foxx-app');
13961396
route.head()
1397-
.then(result => response) {
1398-
// result is empty (no response body)
1397+
.then(response => {
13991398
// response is the response object for
14001399
// HEAD _db/_system/my-foxx-app
14011400
});
@@ -1448,8 +1447,8 @@ route.request({
14481447
body: {hello: 'world'},
14491448
qs: {admin: true}
14501449
})
1451-
.then(result => {
1452-
// result is the response body of calling
1450+
.then(response => {
1451+
// response.body is the response body of calling
14531452
// POST _db/_system/my-foxx-app/hello-world?admin=true
14541453
// with JSON request body '{"hello": "world"}'
14551454
});

0 commit comments

Comments
 (0)