File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,24 @@ var corsOptions = {
21
21
app . get ( '/members' , cors ( corsOptions ) , githubWebhook . getMembers ) ;
22
22
app . get ( '/repos' , cors ( corsOptions ) , githubWebhook . getRepos ) ;
23
23
24
+ /*
25
+ const PORT = process.env.PORT || 2900;
26
+ app.listen(PORT, () => {
27
+ var options = {
28
+ uri: 'https://api.github.com/orgs/lab9k/repos',
29
+ headers: {
30
+ 'User-agent':'henrivdb',
31
+ Authorization: 'token '+ process.env.GITHUB_PERSONAL_ACCESS_TOKEN,
32
+ }
33
+ };
34
+
35
+ request.get(options, function (error, response, body) {
36
+ var sortedBody = JSON.parse(body).sort(function(a, b) {
37
+ return parseFloat(b.pushed_at) - parseFloat(a.pushed_at);
38
+ });
39
+ console.log(sortedBody);
40
+ });
41
+ });
42
+ */
43
+
24
44
module . exports = app ;
Original file line number Diff line number Diff line change @@ -13,8 +13,11 @@ module.exports= {
13
13
} ;
14
14
15
15
request . get ( options , function ( error , response , body ) {
16
+ if ( error != null )
17
+ {
18
+ console . log ( 'error:' , error ) ;
19
+ }
16
20
res . status ( 200 ) . send ( body ) ;
17
- console . log ( 'error:' , error ) ; // Print the error if one occurred
18
21
} ) ;
19
22
20
23
} ,
@@ -30,8 +33,14 @@ module.exports= {
30
33
} ;
31
34
32
35
request . get ( options , function ( error , response , body ) {
33
- res . status ( 200 ) . send ( body ) ;
34
- console . log ( 'error:' , error ) ; // Print the error if one occurred
36
+ if ( error != null )
37
+ {
38
+ console . log ( 'error:' , error ) ;
39
+ }
40
+ var sortedBody = JSON . parse ( body ) . sort ( function ( a , b ) {
41
+ return parseFloat ( b . pushed_at ) - parseFloat ( a . pushed_at ) ;
42
+ } ) ;
43
+ res . status ( 200 ) . send ( sortedBody ) ;
35
44
} ) ;
36
45
37
46
} ,
You can’t perform that action at this time.
0 commit comments