1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var waif = require('../waif')();
|
18 | var service = require('./src/github');
|
19 |
|
20 | var PORT = process.env.PORT || 3000;
|
21 |
|
22 | var ghOpts = {
|
23 | headers: {
|
24 | 'Accept': 'application/vnd.github.v3+json',
|
25 | 'User-Agent': 'Waif-Example-App'
|
26 | }
|
27 | };
|
28 |
|
29 | var ghDomain = 'https://api.github.com';
|
30 |
|
31 | waif('github/repo')
|
32 | .pipe('/:owner/:repo', ghDomain+'/repos/:owner/:repo', ghOpts)
|
33 | .listen(0);
|
34 |
|
35 | waif('github/users')
|
36 | .pipe('/:user', ghDomain+'/users/:user', ghOpts)
|
37 | .listen(0);
|
38 |
|
39 | waif('app')
|
40 | .send('/favicon.ico', null)
|
41 | .pipe('/:user/link', 'https://github.com/:user', { redirect: true })
|
42 | .use(service, { owner: 'wayfin' })
|
43 | .listen(process.env.PORT || 3000);
|
44 |
|
45 | waif.start();
|