|
1 | | -const api = require('./../index.js').server.select('API') |
2 | 1 | const resources = require('./../resources') |
3 | 2 | const Joi = require('joi') |
4 | 3 |
|
5 | | -// https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L818 |
6 | | -api.route({ |
7 | | - method: 'GET', |
8 | | - path: '/api/v0/bootstrap', |
9 | | - handler: resources.bootstrap.list |
10 | | -}) |
| 4 | +module.exports = (server) => { |
| 5 | + const api = server.select('API') |
11 | 6 |
|
12 | | -// https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L866 |
13 | | -api.route({ |
14 | | - method: 'GET', |
15 | | - path: '/api/v0/bootstrap/add', |
16 | | - handler: resources.bootstrap.add, |
17 | | - config: { |
18 | | - validate: { |
19 | | - query: { |
20 | | - arg: Joi.string().required(), // multiaddr to add |
21 | | - default: Joi.boolean() |
| 7 | + // https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L818 |
| 8 | + api.route({ |
| 9 | + method: 'GET', |
| 10 | + path: '/api/v0/bootstrap', |
| 11 | + handler: resources.bootstrap.list |
| 12 | + }) |
| 13 | + |
| 14 | + // https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L866 |
| 15 | + api.route({ |
| 16 | + method: 'GET', |
| 17 | + path: '/api/v0/bootstrap/add', |
| 18 | + handler: resources.bootstrap.add, |
| 19 | + config: { |
| 20 | + validate: { |
| 21 | + query: { |
| 22 | + arg: Joi.string().required(), // multiaddr to add |
| 23 | + default: Joi.boolean() |
| 24 | + } |
22 | 25 | } |
23 | 26 | } |
24 | | - } |
25 | | -}) |
| 27 | + }) |
26 | 28 |
|
27 | | -// https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L1081 |
28 | | -api.route({ |
29 | | - method: 'GET', |
30 | | - path: '/api/v0/bootstrap/list', |
31 | | - handler: resources.bootstrap.list |
32 | | -}) |
| 29 | + // https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L1081 |
| 30 | + api.route({ |
| 31 | + method: 'GET', |
| 32 | + path: '/api/v0/bootstrap/list', |
| 33 | + handler: resources.bootstrap.list |
| 34 | + }) |
33 | 35 |
|
34 | | -// https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L1131 |
35 | | -api.route({ |
36 | | - method: 'GET', |
37 | | - path: '/api/v0/bootstrap/rm', |
38 | | - handler: resources.bootstrap.rm, |
39 | | - config: { |
40 | | - validate: { |
41 | | - query: { |
42 | | - arg: Joi.string().required(), // multiaddr to rm |
43 | | - all: Joi.boolean() |
| 36 | + // https://github.com/ipfs/http-api-spec/blob/master/apiary.apib#L1131 |
| 37 | + api.route({ |
| 38 | + method: 'GET', |
| 39 | + path: '/api/v0/bootstrap/rm', |
| 40 | + handler: resources.bootstrap.rm, |
| 41 | + config: { |
| 42 | + validate: { |
| 43 | + query: { |
| 44 | + arg: Joi.string().required(), // multiaddr to rm |
| 45 | + all: Joi.boolean() |
| 46 | + } |
44 | 47 | } |
45 | 48 | } |
46 | | - } |
47 | | -}) |
| 49 | + }) |
| 50 | +} |
0 commit comments