red-coder-bh/src/main.ts

25 lines
423 B
TypeScript
Raw Normal View History

2022-04-14 20:55:52 +03:00
import express from 'express';
import { config } from 'dotenv';
import { errorHandle } from './utils/error-handling';
config();
const app = express();
const port = process.env.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}`);
});