mirror of
https://github.com/snowball-tools/snowballtools-base.git
synced 2024-11-17 12:19:20 +00:00
Add generic error handling
This commit is contained in:
parent
198478f5fa
commit
6e32d0678a
@ -3,7 +3,7 @@ import { Router } from 'express';
|
||||
const router = Router();
|
||||
|
||||
router.get('/version', async (req, res) => {
|
||||
return res.send({ version: '0.0.4' });
|
||||
return res.send({ version: '0.0.5' });
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
@ -112,6 +112,11 @@ export const createAndStartServer = async (
|
||||
app.use('/api/github', githubRouter);
|
||||
app.use('/staging', stagingRouter);
|
||||
|
||||
app.use((err: any, req: any, res: any, next: any) => {
|
||||
console.error(err);
|
||||
res.status(500).json({ error: 'Internal Server Error' });
|
||||
});
|
||||
|
||||
httpServer.listen(port, host, () => {
|
||||
log(`Server is listening on ${host}:${port}${server.graphqlPath}`);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user