This repository has been archived by the owner on Feb 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroutes.js
101 lines (100 loc) · 2.9 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
var db = require('./utils/db');
module.exports = [
{
method: 'GET',
path: '/',
handler: function(request, reply) {
return reply().code(200);
}
},
{
method: 'GET',
path: '/repos',
handler: function(request, reply) {
return db.get('repos').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/repos',
handler: require('./controllers/repos/put.js')
},
{
method: 'GET',
path: '/repos/partial',
handler: function(request, reply) {
return db.get('repos:partial').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/repos/partial',
handler: require('./controllers/repos/partial/put.js')
},
{
method: 'GET',
path: '/owners',
handler: function(request, reply) {
return db.get('owners').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/owners',
handler: require('./controllers/owners/put.js')
},
{
method: 'GET',
path: '/packages',
handler: function(request, reply) {
return db.get('packages').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/packages',
handler: require('./controllers/packages/put.js')
}, {
method: 'GET',
path: '/packages/bower',
handler: function(request, reply) {
return db.get('packages:bower').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/packages/bower',
handler: require('./controllers/packages/bower/put.js')
}, {
method: 'GET',
path: '/packages/bower/keywords/{keyword}',
handler: function(request, reply) {
var dbKey = 'packages:bower:' + request.params.keyword;
return db.get(dbKey).then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/packages/bower/keywords/{keyword}',
handler: require('./controllers/packages/bower/keywords/put.js')
}, {
method: 'GET',
path: '/packages/npm',
handler: function(request, reply) {
return db.get('packages:npm').then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/packages/npm',
handler: require('./controllers/packages/npm/put.js')
}, {
method: 'GET',
path: '/packages/npm/keywords/{keyword}',
handler: function(request, reply) {
var dbKey = 'packages:npm:' + request.params.keyword;
return db.get(dbKey).then(reply).catch(reply);
}
}, {
method: 'PUT',
path: '/packages/npm/keywords/{keyword}',
handler: require('./controllers/packages/npm/keywords/put.js')
}, {
method: 'GET',
path: '/limit',
handler: require('./controllers/limit/get.js')
}
];