Skip to content

Commit 91ee14c

Browse files
committed
Renamed endpoint to route to avoid confusion.
1 parent da3a025 commit 91ee14c

File tree

7 files changed

+81
-81
lines changed

7 files changed

+81
-81
lines changed

README.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -509,26 +509,26 @@ db.dropFunction('myfuncs::acounting::calculate_vat', function (err) {
509509
});
510510
```
511511

512-
### Arbitrary HTTP endpoints
512+
### Arbitrary HTTP routes
513513

514-
#### database.endpoint([path[, headers]])
514+
#### database.route([path[, headers]])
515515

516-
Returns a new *Endpoint* instance for the given path (relative to the database) that can be used to perform arbitrary HTTP requests.
516+
Returns a new *Route* instance for the given path (relative to the database) that can be used to perform arbitrary HTTP requests.
517517

518518
*Parameter*
519519

520-
* *path* (optional): relative URL of the endpoint.
521-
* *headers* (optional): default headers that should be send with each request to the endpoint.
520+
* *path* (optional): relative URL of the route.
521+
* *headers* (optional): default headers that should be send with each request to the route.
522522

523-
If *path* is missing, the endpoint will refer to the base URL of the database.
523+
If *path* is missing, the route will refer to the base URL of the database.
524524

525-
For more information on *Endpoint* instances see the [*Endpoint API* below](#endpoint-api).
525+
For more information on *Route* instances see the [*Route API* below](#route-api).
526526

527527
*Examples*
528528

529529
```js
530530
var db = require('arangojs')();
531-
var myFoxxApp = db.endpoint('my-foxx-app');
531+
var myFoxxApp = db.route('my-foxx-app');
532532
myFoxxApp.post('users', {
533533
username: 'admin',
534534
password: 'hunter2'
@@ -744,75 +744,75 @@ cursor.all(function (err, result) {
744744
});
745745
```
746746

747-
## Endpoint API
747+
## Route API
748748

749-
*Endpoint* instances provide access for arbitrary HTTP requests. This allows easy access to Foxx apps and other HTTP APIs not covered by the driver itself.
749+
*Route* instances provide access for arbitrary HTTP requests. This allows easy access to Foxx apps and other HTTP APIs not covered by the driver itself.
750750

751-
### endpoint.endpoint([path, [headers]])
751+
### route.route([path, [headers]])
752752

753-
Creates a new *Endpoint* instance representing the *path* relative to the current endpoint. Optionally *headers* can be an object with headers which will be extended with the current endpoint's headers and the connection's headers.
753+
Creates a new *Route* instance representing the *path* relative to the current route. Optionally *headers* can be an object with headers which will be extended with the current route's headers and the connection's headers.
754754

755755
*Examples*
756756

757757
```js
758758
var db = require('arangojs')();
759-
var endpoint = db.endpoint('my-foxx-app');
760-
var users = endpoint.endpoint('users');
761-
// equivalent to db.endpoint('my-foxx-app/users')
759+
var route = db.route('my-foxx-app');
760+
var users = route.route('users');
761+
// equivalent to db.route('my-foxx-app/users')
762762
```
763763

764-
### endpoint.get([path,] [qs,] callback)
764+
### route.get([path,] [qs,] callback)
765765

766766
Performs a GET request to the given URL and passes the server response to the given callback.
767767

768768
*Parameter*
769769

770-
* *path* (optional): the endpoint-relative URL for the request.
770+
* *path* (optional): the route-relative URL for the request.
771771
* *qs* (optional): the query string for the request.
772772

773-
If *path* is missing, the request will be made to the base URL of the endpoint.
773+
If *path* is missing, the request will be made to the base URL of the route.
774774

775775
If *qs* is an object, it will be translated to a query string.
776776

777777
*Examples*
778778

779779
```js
780780
var db = require('arangojs')();
781-
var endpoint = db.endpoint('my-foxx-app');
782-
endpoint.get(function (err, result) {
781+
var route = db.route('my-foxx-app');
782+
route.get(function (err, result) {
783783
if (err) return console.error(err);
784784
// result is the response body of calling
785785
// GET _db/_system/my-foxx-app
786786
});
787787

788788
// -- or --
789789

790-
endpoint.get('users', function (err, result) {
790+
route.get('users', function (err, result) {
791791
if (err) return console.error(err);
792792
// result is the response body of calling
793793
// GET _db/_system/my-foxx-app/users
794794
});
795795

796796
// -- or --
797797

798-
endpoint.get('users', {group: 'admin'}, function (err, result) {
798+
route.get('users', {group: 'admin'}, function (err, result) {
799799
if (err) return console.error(err);
800800
// result is the response body of calling
801801
// GET _db/_system/my-foxx-app/users?group=admin
802802
});
803803
```
804804

805-
### endpoint.post([path,] [body, [qs,]] callback)
805+
### route.post([path,] [body, [qs,]] callback)
806806

807807
Performs a POST request to the given URL and passes the server response to the given callback.
808808

809809
*Parameter*
810810

811-
* *path* (optional): the endpoint-relative URL for the request.
811+
* *path* (optional): the route-relative URL for the request.
812812
* *body* (optional): the request body for the request.
813813
* *qs* (optional): the query string for the request.
814814

815-
If *path* is missing, the request will be made to the base URL of the endpoint.
815+
If *path* is missing, the request will be made to the base URL of the route.
816816

817817
If *body* is an object, it will be converted to JSON.
818818

@@ -822,24 +822,24 @@ If *qs* is an object, it will be translated to a query string.
822822

823823
```js
824824
var db = require('arangojs')();
825-
var endpoint = db.endpoint('my-foxx-app');
826-
endpoint.post(function (err, result) {
825+
var route = db.route('my-foxx-app');
826+
route.post(function (err, result) {
827827
if (err) return console.error(err);
828828
// result is the response body of calling
829829
// POST _db/_system/my-foxx-app
830830
});
831831

832832
// -- or --
833833

834-
endpoint.post('users', function (err, result) {
834+
route.post('users', function (err, result) {
835835
if (err) return console.error(err);
836836
// result is the response body of calling
837837
// POST _db/_system/my-foxx-app/users
838838
});
839839

840840
// -- or --
841841

842-
endpoint.post('users', {
842+
route.post('users', {
843843
username: 'admin',
844844
password: 'hunter2'
845845
}, function (err, result) {
@@ -851,7 +851,7 @@ endpoint.post('users', {
851851

852852
// -- or --
853853

854-
endpoint.post('users', {
854+
route.post('users', {
855855
username: 'admin',
856856
password: 'hunter2'
857857
}, {admin: true}, function (err, result) {
@@ -862,17 +862,17 @@ endpoint.post('users', {
862862
});
863863
```
864864

865-
### endpoint.put([path,] [body, [qs,]] callback)
865+
### route.put([path,] [body, [qs,]] callback)
866866

867867
Performs a PUT request to the given URL and passes the server response to the given callback.
868868

869869
*Parameter*
870870

871-
* *path* (optional): the endpoint-relative URL for the request.
871+
* *path* (optional): the route-relative URL for the request.
872872
* *body* (optional): the request body for the request.
873873
* *qs* (optional): the query string for the request.
874874

875-
If *path* is missing, the request will be made to the base URL of the endpoint.
875+
If *path* is missing, the request will be made to the base URL of the route.
876876

877877
If *body* is an object, it will be converted to JSON.
878878

@@ -882,24 +882,24 @@ If *qs* is an object, it will be translated to a query string.
882882

883883
```js
884884
var db = require('arangojs')();
885-
var endpoint = db.endpoint('my-foxx-app');
886-
endpoint.put(function (err, result) {
885+
var route = db.route('my-foxx-app');
886+
route.put(function (err, result) {
887887
if (err) return console.error(err);
888888
// result is the response body of calling
889889
// PUT _db/_system/my-foxx-app
890890
});
891891

892892
// -- or --
893893

894-
endpoint.put('users/admin', function (err, result) {
894+
route.put('users/admin', function (err, result) {
895895
if (err) return console.error(err);
896896
// result is the response body of calling
897897
// PUT _db/_system/my-foxx-app/users
898898
});
899899

900900
// -- or --
901901

902-
endpoint.put('users/admin', {
902+
route.put('users/admin', {
903903
username: 'admin',
904904
password: 'hunter2'
905905
}, function (err, result) {
@@ -911,7 +911,7 @@ endpoint.put('users/admin', {
911911

912912
// -- or --
913913

914-
endpoint.put('users/admin', {
914+
route.put('users/admin', {
915915
username: 'admin',
916916
password: 'hunter2'
917917
}, {admin: true}, function (err, result) {
@@ -922,42 +922,42 @@ endpoint.put('users/admin', {
922922
});
923923
```
924924

925-
### endpoint.patch([path,] [body, [qs,]] callback)
925+
### route.patch([path,] [body, [qs,]] callback)
926926

927927
Performs a PATCH request to the given URL and passes the server response to the given callback.
928928

929929
*Parameter*
930930

931-
* *path* (optional): the endpoint-relative URL for the request.
931+
* *path* (optional): the route-relative URL for the request.
932932
* *body* (optional): the request body for the request.
933933
* *qs* (optional): the query string for the request.
934934

935-
If *path* is missing, the request will be made to the base URL of the endpoint.
935+
If *path* is missing, the request will be made to the base URL of the route.
936936

937937
If *body* is an object, it will be converted to JSON.
938938

939939
If *qs* is an object, it will be translated to a query string.
940940

941941
```js
942942
var db = require('arangojs')();
943-
var endpoint = db.endpoint('my-foxx-app');
944-
endpoint.patch(function (err, result) {
943+
var route = db.route('my-foxx-app');
944+
route.patch(function (err, result) {
945945
if (err) return console.error(err);
946946
// result is the response body of calling
947947
// PATCH _db/_system/my-foxx-app
948948
});
949949

950950
// -- or --
951951

952-
endpoint.patch('users/admin', function (err, result) {
952+
route.patch('users/admin', function (err, result) {
953953
if (err) return console.error(err);
954954
// result is the response body of calling
955955
// PATCH _db/_system/my-foxx-app/users
956956
});
957957

958958
// -- or --
959959

960-
endpoint.patch('users/admin', {
960+
route.patch('users/admin', {
961961
password: 'hunter2'
962962
}, function (err, result) {
963963
if (err) return console.error(err);
@@ -968,7 +968,7 @@ endpoint.patch('users/admin', {
968968

969969
// -- or --
970970

971-
endpoint.patch('users/admin', {
971+
route.patch('users/admin', {
972972
password: 'hunter2'
973973
}, {admin: true}, function (err, result) {
974974
if (err) return console.error(err);
@@ -978,97 +978,97 @@ endpoint.patch('users/admin', {
978978
});
979979
```
980980

981-
### endpoint.delete([path,] [qs,] callback)
981+
### route.delete([path,] [qs,] callback)
982982

983983
Performs a DELETE request to the given URL and passes the server response to the given callback.
984984

985985
*Parameter*
986986

987-
* *path* (optional): the endpoint-relative URL for the request.
987+
* *path* (optional): the route-relative URL for the request.
988988
* *qs* (optional): the query string for the request.
989989

990-
If *path* is missing, the request will be made to the base URL of the endpoint.
990+
If *path* is missing, the request will be made to the base URL of the route.
991991

992992
If *qs* is an object, it will be translated to a query string.
993993

994994
*Examples*
995995

996996
```js
997997
var db = require('arangojs')();
998-
var endpoint = db.endpoint('my-foxx-app');
999-
endpoint.delete(function (err, result) {
998+
var route = db.route('my-foxx-app');
999+
route.delete(function (err, result) {
10001000
if (err) return console.error(err);
10011001
// result is the response body of calling
10021002
// DELETE _db/_system/my-foxx-app
10031003
});
10041004

10051005
// -- or --
10061006

1007-
endpoint.delete('users/admin', function (err, result) {
1007+
route.delete('users/admin', function (err, result) {
10081008
if (err) return console.error(err);
10091009
// result is the response body of calling
10101010
// DELETE _db/_system/my-foxx-app/users/admin
10111011
});
10121012

10131013
// -- or --
10141014

1015-
endpoint.delete('users/admin', {permanent: true}, function (err, result) {
1015+
route.delete('users/admin', {permanent: true}, function (err, result) {
10161016
if (err) return console.error(err);
10171017
// result is the response body of calling
10181018
// DELETE _db/_system/my-foxx-app/users/admin?permanent=true
10191019
});
10201020
```
10211021

1022-
### endpoint.head([path,] [qs,] callback)
1022+
### route.head([path,] [qs,] callback)
10231023

10241024
Performs a HEAD request to the given URL and passes the server response to the given callback.
10251025

10261026
*Parameter*
10271027

1028-
* *path* (optional): the endpoint-relative URL for the request.
1028+
* *path* (optional): the route-relative URL for the request.
10291029
* *qs* (optional): the query string for the request.
10301030

1031-
If *path* is missing, the request will be made to the base URL of the endpoint.
1031+
If *path* is missing, the request will be made to the base URL of the route.
10321032

10331033
If *qs* is an object, it will be translated to a query string.
10341034

10351035
*Examples*
10361036

10371037
```js
10381038
var db = require('arangojs')();
1039-
var endpoint = db.endpoint('my-foxx-app');
1040-
endpoint.head(function (err, result, response) {
1039+
var route = db.route('my-foxx-app');
1040+
route.head(function (err, result, response) {
10411041
if (err) return console.error(err);
10421042
// result is empty (no response body)
10431043
// response is the response object for
10441044
// HEAD _db/_system/my-foxx-app
10451045
});
10461046
```
10471047

1048-
### endpoint.request(opts, callback)
1048+
### route.request(opts, callback)
10491049

10501050
Performs an arbitrary request to the given URL and passes the server response to the given callback.
10511051

10521052
*Parameter*
10531053

10541054
* *opts*: an object with the following properties:
1055-
* *path*: the endpoint-relative URL for the request.
1056-
* *absolutePath* (optional): whether the *path* is relative to the connection's base URL instead of the endpoint. Default: `false`.
1055+
* *path*: the route-relative URL for the request.
1056+
* *absolutePath* (optional): whether the *path* is relative to the connection's base URL instead of the route. Default: `false`.
10571057
* *body* (optional): the request body.
10581058
* *qs* (optional): the query string.
10591059
* *headers* (optional): an object containing additional HTTP headers to send with the request.
10601060
* *method* (optional): HTTP method to use. Default: `"GET"`.
10611061

1062-
If *opts.path* is missing, the request will be made to the base URL of the endpoint.
1062+
If *opts.path* is missing, the request will be made to the base URL of the route.
10631063

10641064
If *opts.body* is an object, it will be converted to JSON.
10651065

10661066
If *opts.qs* is an object, it will be translated to a query string.
10671067

10681068
```js
10691069
var db = require('arangojs')();
1070-
var endpoint = db.endpoint('my-foxx-app');
1071-
endpoint.request({
1070+
var route = db.route('my-foxx-app');
1071+
route.request({
10721072
path: 'hello-world',
10731073
method: 'POST',
10741074
body: {hello: 'world'},

0 commit comments

Comments
 (0)