File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
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 } !` ) ) ;
You can’t perform that action at this time.
0 commit comments