|
|
@ -22,17 +22,15 @@ app.prepare()
|
|
|
|
server.use(morgan('tiny'))
|
|
|
|
server.use(morgan('tiny'))
|
|
|
|
|
|
|
|
|
|
|
|
// if root, render webpage from next
|
|
|
|
// if root, render webpage from next
|
|
|
|
server.get('/', (req, res) => {
|
|
|
|
server.get('*', (req, res) =>
|
|
|
|
return app.render(req, res, '/', req.query)
|
|
|
|
app.render(req, res, '/', req.query))
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// otherwise, try and get gist
|
|
|
|
|
|
|
|
server.get('*', handle)
|
|
|
|
|
|
|
|
|
|
|
|
// api endpoints
|
|
|
|
// api endpoints
|
|
|
|
server.post('/upload', bodyParser.json(), wrap(require('./handlers/upload')))
|
|
|
|
server.post('/upload', bodyParser.json(), wrap(require('./handlers/upload')))
|
|
|
|
|
|
|
|
|
|
|
|
// otherwise, try and get gist
|
|
|
|
|
|
|
|
server.get('*', (req, res) => {
|
|
|
|
|
|
|
|
return handle(req, res)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server.listen(3000, (err) => {
|
|
|
|
server.listen(3000, (err) => {
|
|
|
|
if (err) throw err
|
|
|
|
if (err) throw err
|
|
|
|