-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (31 loc) · 951 Bytes
/
app.js
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
37
import dotenv from "dotenv";
import { resolve } from "path";
dotenv.config();
import "./src/database";
import express from "express";
import homeRoutes from "./src/routes/homeRoutes";
import userRoutes from "./src/routes/userRoutes";
import tokenRoutes from "./src/routes/tokenRoutes";
import studentRoutes from "./src/routes/studentRoutes";
import photoRoutes from "./src/routes/photoRoutes";
class App {
constructor() {
this.app = express();
this.middlewares();
this.routes();
}
middlewares() {
this.app.use(express.urlencoded({ extended: true }));
this.app.use(express.json());
this.app.use(express.static(resolve(__dirname, "uploads")));
}
routes() {
this.app.use("/", homeRoutes);
this.app.use("/users/", userRoutes);
this.app.use("/tokens/", tokenRoutes);
this.app.use("/students/", studentRoutes);
this.app.use("/photos/", photoRoutes);
}
}
// express
export default new App().app;