File tree Expand file tree Collapse file tree 3 files changed +21
-13
lines changed
Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 11import type { Request , Response } from "express" ;
22import type { Probot } from "probot" ;
33import express from "express" ;
4- import getProbotStats from "@/src/router/probot- stats.ts" ;
4+ import getStatsHandlers from "@/src/router/stats.ts" ;
55import getRepoHandlers from "@/src/router/repo-handler.ts" ;
66
77const createRouter = ( app : Probot ) => {
@@ -15,7 +15,8 @@ const createRouter = (app: Probot) => {
1515 res . json ( { status : "pong" } ) ;
1616 } ) ;
1717
18- router . get ( "/probot/stats" , getProbotStats ) ;
18+ const { probotStatsHandler } = getStatsHandlers ( app ) ;
19+ router . get ( "/probot/stats" , probotStatsHandler ) ;
1920
2021 const { checkHandler } = getRepoHandlers ( app ) ;
2122 router . get ( "/check/:owner/:repo" , checkHandler ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import type { Request , Response } from "express" ;
2+ import { Probot } from "probot" ;
3+
4+ function getStatsHandlers ( _app : Probot ) {
5+ async function probotStatsHandler ( _req : Request , res : Response ) {
6+ const response = await fetch (
7+ "https://raw.githack.com/pull-app/stats/master/stats.json" ,
8+ ) ;
9+ const data = await response . json ( ) ;
10+ res . json ( data ) ;
11+ }
12+
13+ return {
14+ probotStatsHandler,
15+ } ;
16+ }
17+
18+ export default getStatsHandlers ;
You can’t perform that action at this time.
0 commit comments