Skip to content

Commit

Permalink
🚚 Restructure auth routes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
rutu363 committed Sep 7, 2020
1 parent b0b80ab commit 1b1f46b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ require("dotenv").config();
const express = require("express");
const cors = require("cors");
const bodyParser = require("body-parser");
const routes = require("./routes");
const blogRoutes = require("./routes/blogs/blogRoutes");
const authRoutes = require("./routes/auths/authRoutes");

const cookieParser = require("cookie-parser");
const PORT = process.env.PORT;
Expand All @@ -15,7 +15,7 @@ app.use(cors());
app.use(express.static(__dirname + "/public"));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use("/", routes);

This comment has been minimized.

Copy link
@tanmayc07

tanmayc07 Sep 7, 2020

Owner

Need not delete this line. Resolve this! Also, line no 5

app.use("/auth", authRoutes);
app.use("/blogs", blogRoutes);

app.set("views", "./views");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const handleErrors = (err) => {
}

module.exports.register_get = (req, res) => {
res.render("registerpage");
res.render("register");
}

module.exports.login_get = (req, res) => {
Expand Down
7 changes: 3 additions & 4 deletions routes/index.js → routes/auths/authRoutes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const routes = require("express").Router();
const ctrIndex = require("../controllers/index.controllers");
const authController = require("../controllers/auth.controllers");
const { requireAuth } = require("../middleware/authMiddleware");
const authController = require("../../controllers/authControllers");
const { requireAuth } = require("../../middleware/authMiddleware");

routes.route("/").get(ctrIndex.Index);

This comment has been minimized.

Copy link
@tanmayc07

tanmayc07 Sep 7, 2020

Owner

Why did you delete this? We need index route for the landing page.

This comment has been minimized.

Copy link
@rutu363

rutu363 Sep 7, 2020

Author Collaborator

Added

//routes.route("/").get(ctrIndex.Index);

routes.route("/login").get(authController.login_get);
routes.route("/login").post(authController.login_post);
Expand Down
2 changes: 1 addition & 1 deletion views/registerpage.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</div>

<div class="input-field col l12 center">
<input type="password" autocomplete="off" id="password" name="password" required>
<input type="password" autocomplete="off" id="passwo rd" name="password" required>

This comment has been minimized.

Copy link
@tanmayc07

tanmayc07 Sep 7, 2020

Owner

Did you intend to write id as as you have done? Or is it typo?

This comment has been minimized.

Copy link
@rutu363

rutu363 Sep 7, 2020

Author Collaborator

typo

This comment has been minimized.

Copy link
@tanmayc07

tanmayc07 Sep 7, 2020

Owner

Okay

<label for="">Password</label>
<br> <br>
<button class="btn-large" type="submit" style="background-color: #6C63FF">Register</button>
Expand Down

0 comments on commit 1b1f46b

Please sign in to comment.