red-coder-bh/src/main.ts

25 lines
436 B
TypeScript

import express from 'express';
import { config } from 'dotenv';
import { errorHandle } from './utils/error-handling';
config();
const app = express();
const port = process.env.RED_CODER_BH_PORT;
app.get('/', (req, res) => {
res.send('hello')
})
app.get('/error', (req, res) => {
throw new Error('some mistake')
})
app.use(errorHandle);
app.listen(port, () => {
console.log(`listen on http://localhost:${port}`);
});