-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (26 loc) · 824 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
import express from "express";
import logger from "morgan";
import * as OpenApiValidator from "express-openapi-validator";
import sequelize from "./config/db.js";
import projectsRouter from "./routes/projects/index.js";
import projectTasksRouter from "./routes/projects/tasks.js";
import tagsRouter from "./routes/tags.js";
import tasksRouter from "./routes/tasks.js";
const app = express();
app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(
OpenApiValidator.middleware({
apiSpec: "./openapi.yaml",
}),
);
app.use("/projects", projectsRouter);
app.use("/projects/:projId/tasks", projectTasksRouter);
app.use("/tags", tagsRouter);
app.use("/tasks", tasksRouter);
sequelize.sync()
.then(() => {
console.log("DB synced");
});
export default app;