-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (19 loc) · 798 Bytes
/
Copy pathapp.js
File metadata and controls
24 lines (19 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const express = require("express");
const http = require("http");
const path = require("path");
const cors = require("cors");
const {routesInit} = require("./routes/configRoutes")
const app = express();
app.use(cors());
// מאפשר לשלוח באדי דרך הצד לקוח
app.use(express.json());
// להגדיר תיקייה סטטית שתיהיה התיקייה בשם פאבליק
app.use(express.static(path.join(__dirname,"public")));
routesInit(app);
const server = http.createServer(app);
// בודק אם אנחנו על שרת אמיתי ואם כן דואג שנקבל את הפורט שהענן צריך
// אם לא הברירת מחדל תיהיה 3003
const port = process.env.PORT || 3003;
server.listen(port,()=>{
console.log("server is running on port " + port);
});