mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-15 10:27:43 +08:00
19 lines
481 B
TypeScript
19 lines
481 B
TypeScript
import * as path from 'path'
|
|
import * as express from 'express'
|
|
|
|
export = (robot: any): void => {
|
|
const app = robot.route()
|
|
|
|
app.get('/probot', (req: express.Request, res: express.Response) => {
|
|
let pkg
|
|
try {
|
|
pkg = require(path.join(process.cwd(), 'package.json'))
|
|
} catch (e) {
|
|
pkg = {}
|
|
}
|
|
|
|
res.render('probot.hbs', pkg)
|
|
})
|
|
app.get('/', (req: express.Request, res: express.Response, next: express.NextFunction) => res.redirect('/probot'))
|
|
}
|