Browse Source

Create outline for create workout route.

Lee Morgan 1 year ago
parent
commit
ce4fb39e95
3 changed files with 20 additions and 0 deletions
  1. 2 0
      app.js
  2. 9 0
      controllers/workout.js
  3. 9 0
      routes/workout.js

+ 2 - 0
app.js

@@ -9,6 +9,7 @@ import {catchError} from "./HttpError.js";
 
 import otherRoutes from "./routes/other.js";
 import userRoutes from "./routes/user.js";
+import workoutRoutes from "./routes/workout.js";
 
 let mongoString = "mongodb://127.0.0.1/workout";
 if(process.env.NODE_ENV === "production"){
@@ -36,6 +37,7 @@ app.use(express.json());
 
 otherRoutes(app);
 userRoutes(app);
+workoutRoutes(app);
 
 app.use(catchError);
 

+ 9 - 0
controllers/workout.js

@@ -0,0 +1,9 @@
+const createRoute = async (req, res, next)=>{
+    try{
+        return null;
+    }catch(e){next(e)}
+}
+
+export {
+    createRoute
+}

+ 9 - 0
routes/workout.js

@@ -0,0 +1,9 @@
+import {
+    createRoute
+} from "../controllers/workout.js";
+
+import {userAuth} from "../auth.js";
+
+export default (app)=>{
+    app.get("/workout", userAuth, createRoute);
+}