-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
33 lines (27 loc) · 1013 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
// Imports from libraries
const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
// Imports from projects
const viewsRoutes = require("./routes/viewsRoutes");
const weekMenusRoutes = require("./routes/weekMenusRoutes");
const fridgeRoutes = require("./routes/fridgeRoutes");
const tagRoutes = require("./routes/tagRoutes");
const recipeRoutes = require("./routes/recipeRoutes");
const dbRoutes = require("./routes/db");
const { db } = require("./models/recipes/recipeModel");
const app = express();
// Req body modifiers
app.use(bodyParser.urlencoded({ extended: true }));
// Views middleware
app.set("view engine", "ejs");
app.use(express.static("public"));
// -----------------------------------
// ROUTERS
app.use("/", viewsRoutes);
app.post("/mealList", weekMenusRoutes);
app.post("/ingredientList", fridgeRoutes);
app.post("/randomList", tagRoutes);
app.get("/recipe/:mealId", recipeRoutes);
app.post("/savedRecipe", dbRoutes);
module.exports = app;