Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
MatzJeurissen committed Mar 22, 2023
1 parent 3865d74 commit 8b5463c
Show file tree
Hide file tree
Showing 15 changed files with 845 additions and 205 deletions.
16 changes: 8 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const session = require('express-session');
const cookieParser = require('cookie-parser');
const flash = require('connect-flash');
const bodyParser = require("body-parser");
const { adminAuth, userAuth } = require("./middleware/auth.js");
// const { adminAuth, userAuth } = require("./middleware/auth.js");
const connectDB = require("./db");

const app = express();
Expand Down Expand Up @@ -130,21 +130,21 @@ app.set('view engine', 'ejs');
const routes = require('./server/routes/recipeRoutes.js')
app.use('/', routes);

// const authRoutes= require('./server/routes/recipeRoutes.js')
// app.use('/', authRoutes);
const authRoutes= require('./server/routes/authRoutes.js')
app.use('/', authRoutes);
connectDB();
// Routes
app.use("/api/auth", require("./Auth/route"));

app.get("/", (req, res) => res.render("home"));
app.get("/register", (req, res) => res.render("register"));
app.get("/login", (req, res) => res.render("login"));
// app.get("/", (req, res) => res.render("home"));
// app.get("/register", (req, res) => res.render("register"));
// app.get("/login", (req, res) => res.render("login"));
app.get("/logout", (req, res) => {
res.cookie("jwt", "", { maxAge: "1" });
res.redirect("/");
});
app.get("/admin", adminAuth, (req, res) => res.render("admin"));
app.get("/basic", userAuth, (req, res) => res.render("user"));
// app.get("/admin", adminAuth, (req, res) => res.render("admin"));
// app.get("/basic", userAuth, (req, res) => res.render("user"));

app.listen(port, ()=> console.log(`Listening to port ${port}`));

Expand Down
13 changes: 13 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"accesscontrol": "^2.2.1",
"bcrypt": "^5.1.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.2",
Expand Down
Loading

0 comments on commit 8b5463c

Please sign in to comment.