blob: 74e0ef83bdd894478619966b43732459c5d3d40b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { createServer } from 'http';
import { apiHandler } from './api.mjs';
const PORT = process.env.PORT || 8085;
const server = createServer((req, res) => {
apiHandler(req, res).catch(err => {
console.error(err);
res.writeHead(500, {
'Content-Type': 'text/plain'
});
res.end(err.toString());
})
});
server.listen(PORT);
console.log(`API running at http://localhost:${PORT}`);
|