We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c4fe8c commit 4bb32fbCopy full SHA for 4bb32fb
1 file changed
index.js
@@ -0,0 +1,26 @@
1
+import express from "express";
2
+import { dbConnection } from './db/db.js';
3
+import { entrypoint } from "./entrypoint.js";
4
+import dotenv from "dotenv";
5
+import morgan from "morgan";
6
+import cors from 'cors'
7
+import { createOnlineOrder } from "./components/order/order_controller.js";
8
+
9
+dotenv.config();
10
+const app = express();
11
+app.use(cors())
12
13
+const port = 3000;
14
+app.post('/webhook', express.raw({ type: 'application/json' }), createOnlineOrder);
15
+app.use(express.json());
16
+app.use(morgan("dev"));
17
+app.use(express.static("uploads"));
18
19
+// call: entrypoint
20
+entrypoint(app);
21
22
+// initalize DB connection
23
+dbConnection();
24
25
+// start the server
26
+app.listen(process.env.PORT || port, () => console.log(`Backend running on: ${port}!`));
0 commit comments