19 lines
371 B
JavaScript
19 lines
371 B
JavaScript
import express from "express";
|
|
import cors from "cors";
|
|
|
|
const app = express();
|
|
const port = 9001;
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Server is running on http://localhost:${port}`);
|
|
});
|
|
|
|
|
|
// error handling code
|
|
app.use((err, req, res, next) => {
|
|
console.error(err.stack);
|
|
res.status(500).send("Something broke!");
|
|
}); |