-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
36 lines (29 loc) · 903 Bytes
/
Copy pathindex.ts
File metadata and controls
36 lines (29 loc) · 903 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
25
26
27
28
29
30
31
32
33
34
35
36
import dotenv from "dotenv";
dotenv.config();
import { Express } from "express";
import { Connection } from "mysql2/promise";
import { initDataBase } from "./Server/services/db";
import { initServer } from "./Server/services/server";
import { Server } from "socket.io";
import { initSocketServer } from "./Server/services/socket";
import ShopAPI from "./Shop.API";
import ShopAdmin from "./Shop.Admin";
export let server: Express;
export let connection: Connection;
export let ioServer: Server;
async function launchApplication() {
server = initServer();
connection = await initDataBase();
ioServer = initSocketServer(server);
initRouter();
}
function initRouter() {
const shopApi = ShopAPI(connection);
server.use("/api", shopApi);
const shopAdmin = ShopAdmin();
server.use("/admin", shopAdmin);
server.get("/", (req, res) => {
res.send("Not a React App");
});
}
launchApplication();