Files
probot/lib/server.js
2018-01-12 08:10:10 -06:00

21 lines
554 B
JavaScript

const path = require('path')
const express = require('express')
// Teach express to properly handle async errors
require('express-async-errors')
const logging = require('./middleware/logging')
module.exports = function ({webhook, logger}) {
const app = express()
app.use(logging({logger}))
app.use('/probot/static/', express.static(path.join(__dirname, '..', 'static')))
app.use(webhook)
app.set('view engine', 'hbs')
app.set('views', path.join(__dirname, '..', 'views'))
app.get('/ping', (req, res) => res.end('PONG'))
return app
}