added backend files
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import apiRouter from "./routes/api.route.js";
|
||||
|
||||
const app = express();
|
||||
const port = 9001;
|
||||
@@ -11,9 +12,10 @@ app.listen(port, () => {
|
||||
console.log(`Server is running on http://localhost:${port}`);
|
||||
});
|
||||
|
||||
app.use("/api", apiRouter);
|
||||
|
||||
// error handling code
|
||||
app.use((err, req, res, next) => {
|
||||
console.error(err.stack);
|
||||
res.status(500).send("Something broke!");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user