Add generic error handling

This commit is contained in:
Gilbert committed 2024-06-19 22:31:07 -05:00
1 parent 198478f5fa
commit 6e32d0678a
2 files changed
+6 -1

No files matched your search

+1 -1
View File
@@ -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;
+5
View File
@@ -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}`);
});