From fce18f25320164de965b634e56e8b3f77cad1c22 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 18:46:32 +0300 Subject: [PATCH 01/21] creating hello world controller JS-MongoDB-Prisma-NoAuth-Template --- .../src/controllers/controller.js | 7 ------- .../src/controllers/helloWorldController.js | 9 +++++++++ .../src/routes/helloWorldRoutes.js | 8 ++++++++ .../src/routes/router.js | 5 ----- 4 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/controller.js create mode 100644 packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/helloWorldController.js create mode 100644 packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js delete mode 100644 packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/router.js diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/controller.js b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/controller.js deleted file mode 100644 index 6b230749..00000000 --- a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -export const controller = async (req, res) => { - try { - - } catch (error) { - - } -}; \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/helloWorldController.js new file mode 100644 index 00000000..107fb387 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/controllers/helloWorldController.js @@ -0,0 +1,9 @@ +export const helloWorld = async (req, res) => { + try { + res.send("Hello World!"); + } catch (error) { + res.status(500).json({ + message: "Internal Server Error", + }); + } + }; \ No newline at end of file diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js new file mode 100644 index 00000000..ff85ddba --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -0,0 +1,8 @@ +import express from "express"; +import { helloWorld } from "../controllers/helloWorldController.js"; + +const helloWorldRouter = express.Router(); + +helloWorldRouter.get("/", helloWorld); + +export default helloWorldRouter; diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/router.js b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/router.js deleted file mode 100644 index 2c054c51..00000000 --- a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/routes/router.js +++ /dev/null @@ -1,5 +0,0 @@ -import express from "express"; - -const routerName = express.Router(); - -export default routerName; From 10e38c505f038045cfc7b4993e851038a9e59c83 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:00:57 +0300 Subject: [PATCH 02/21] update template JS-MySQL-Prisma-NoAuth-Template --- .../JS-MySQL-Prisma-NoAuth-Template/src/routes/router.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/router.js diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/router.js b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/router.js deleted file mode 100644 index 18b49770..00000000 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/router.js +++ /dev/null @@ -1,5 +0,0 @@ -import express from "express"; - -const routerName = express.Router(); - -export default routerName; \ No newline at end of file From 9342fe41ca2edada58e8df28923cbe87632761b0 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:01:50 +0300 Subject: [PATCH 03/21] update template JS-MySQL-Prisma-NoAuth-Template --- .../src/controllers/controller.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/controller.js diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/controller.js b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/controller.js deleted file mode 100644 index 3252cc1d..00000000 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -export const controller = async (req, res) => { - try { - - } catch (error) { - - } -}; \ No newline at end of file From 96d860b8d5e0b722d7bea490dbcea93680f2cdc3 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:15:00 +0300 Subject: [PATCH 04/21] creating hello world controller JS-MySQL-Prisma-NoAuth-Template --- .../src/controllers/helloWorldController.js | 11 +++++++++++ .../src/routes/helloWorldRoutes.js | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/helloWorldController.js create mode 100644 packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/helloWorldController.js new file mode 100644 index 00000000..59bcb4ac --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/controllers/helloWorldController.js @@ -0,0 +1,11 @@ +export const hellWorld = async (res, req)=>{ + try{ + + res.send("Hello world!") + + }catch(err){ + res.status(500).json({ + message: "Internal Server Error" + }) + } +} \ No newline at end of file diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js new file mode 100644 index 00000000..f8df2dae --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -0,0 +1,8 @@ +import express from 'express' +import { hellWorld } from '../controllers/helloWorldController.js' + +const hellWorldRouter = express.Router() + +hellWorldRouter.get("/", hellWorld) + +export default hellWorldRouter; \ No newline at end of file From f3219431bfa6853a6927085119aff03c21872fe7 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:20:57 +0300 Subject: [PATCH 05/21] updated app.js --- .../JS-MySQL-Prisma-NoAuth-Template/src/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/app.js b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/app.js index 31f5f275..ec760c74 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/app.js +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/src/app.js @@ -11,6 +11,9 @@ app.use(express.json()); // rest of your code here +// Use you Routes here +pp.use("/api/helloworld", helloWorldRouter); + app.listen(port, () => { console.log(`${chalk.green.bold("Server")} is listening on port ${port}`); From 12e5740000be56fe9bab5d1d282c4413417afb70 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:27:11 +0300 Subject: [PATCH 06/21] updated app.js JS-MongoDB-Prisma-NoAuth-Template --- .../JS-MongoDB-Prisma-NoAuth-Template/src/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/app.js b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/app.js index d02ae925..7cc0fc4e 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/app.js +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/src/app.js @@ -9,6 +9,13 @@ import { port } from "./config/initial.config.js"; const app = express(); app.use(express.json()); + +// use your routes here + +app.use("/api/helloworld", helloWorldRouter); + + + // rest of your code here From d3c338e045033adde006bc6b495fa8bdd43ef9bb Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:31:19 +0300 Subject: [PATCH 07/21] JS-PostgreSQL-Sequelize-NoAuth-Template --- .../src/controllers/controller.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/controller.js diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/controller.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/controller.js deleted file mode 100644 index 3252cc1d..00000000 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -export const controller = async (req, res) => { - try { - - } catch (error) { - - } -}; \ No newline at end of file From 604d43e50758885ab789288f3f00eb2fb69ee869 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:34:58 +0300 Subject: [PATCH 08/21] adding new controller --- .../src/controllers/helloWorldController.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/helloWorldController.js diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/helloWorldController.js new file mode 100644 index 00000000..a2c8eca7 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/controllers/helloWorldController.js @@ -0,0 +1,13 @@ + +export const helloWorld = async (res, req) => { + try { + // Send a simple string as a response + res.send("Hello World!") + } catch (err) { + // If there's an error, send a response with a 500 status code + // and an error message + res.status(500).json({ + message: "Internal Server Error" + }) + } +} From 1496d6be0f47543b26e3dc4c4543793b28d1a9ea Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:35:33 +0300 Subject: [PATCH 09/21] removing oldes router --- .../src/routes/router.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/router.js diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/router.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/router.js deleted file mode 100644 index 18b49770..00000000 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/router.js +++ /dev/null @@ -1,5 +0,0 @@ -import express from "express"; - -const routerName = express.Router(); - -export default routerName; \ No newline at end of file From 6a112ab824447f6d865fef9e6247ebb1562b7bd8 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:38:12 +0300 Subject: [PATCH 10/21] adding new router --- .../src/routes/helloWorldRoutes.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js new file mode 100644 index 00000000..73768eb3 --- /dev/null +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -0,0 +1,8 @@ +import express from "express" +import { helloWorld } from "../controllers/helloWorldController.js" + +const hellWorldRouter = express.Router() + +hellWorldRouter.get("/" , helloWorld) + +export default hellWorldRouter; \ No newline at end of file From 48e307d3d693874f1ffcd2d567772cc54bc6e6e4 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:42:27 +0300 Subject: [PATCH 11/21] finally updated our app.js --- .../JS-PostgreSQL-Sequelize-NoAuth-Template/src/app.js | 3 +++ .../src/routes/helloWorldRoutes.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/app.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/app.js index c83b05a9..7e6ca22f 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/app.js +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/app.js @@ -11,6 +11,9 @@ import './models/models.js'; const app = express(); app.use(express.json()); +// User Your Routes here +app.use("/api/helloworld", helloWorldRouter); + // rest of your code here diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js index 73768eb3..66a5c47f 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -5,4 +5,4 @@ const hellWorldRouter = express.Router() hellWorldRouter.get("/" , helloWorld) -export default hellWorldRouter; \ No newline at end of file +export default hellWorldRouter; From 4070cc2655c025e5a0f3db45e7158dcd95aa0009 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:49:08 +0300 Subject: [PATCH 12/21] JS-MongoDB-TypeORM-NoAuth-Template --- .../src/controllers/controller.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/controller.js diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/controller.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/controller.js deleted file mode 100644 index e641c1a7..00000000 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -export const controller = async (req, res) => { - try { - - } catch (error) { - - } -}; \ No newline at end of file From b3bf15e05bbf758a817d251d7d19c746860d8bdc Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:52:31 +0300 Subject: [PATCH 13/21] adding new controller hello world JS-MongoDB-TypeORM-NoAuth-Template --- .../src/controllers/helloWorldController.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js new file mode 100644 index 00000000..0f5f140c --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js @@ -0,0 +1,25 @@ +/** + * Hello World controller + * + * This is a simple controller that returns a "Hello World" message + * in the response body. It is a good example of how to create a basic + * controller in Yonode. + * + * @param {Object} res The Express.js response object + * @param {Object} req The Express.js request object + */ +export const hellWorld = async (res, req) => { + try { + + // Send a "Hello World" message in the response body + res.send("Hello World"); + + } catch (err) { + // If there is an error, send a 500 Internal Server Error + // with a message in the response body + res.status(500).json({ + message: "Internal Server Error" + }); + } +} + From 3fb1fbb5b1ca5970214bb8a4bf5ae4ac5839f9bd Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:53:33 +0300 Subject: [PATCH 14/21] updated our routes JS-MongoDB-TypeORM-NoAuth-Template --- .../JS-MongoDB-TypeORM-NoAuth-Template/src/routes/router.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/router.js diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/router.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/router.js deleted file mode 100644 index 18b49770..00000000 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/router.js +++ /dev/null @@ -1,5 +0,0 @@ -import express from "express"; - -const routerName = express.Router(); - -export default routerName; \ No newline at end of file From a30b363fe13c0a8192aaea1562f588c39afe9a1f Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:57:44 +0300 Subject: [PATCH 15/21] adding new routes hello Routes JS-MongoDB-TypeORM-NoAuth-Template --- .../src/controllers/helloWorldController.js | 2 +- .../src/routes/helloWorldRoutes.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js index 0f5f140c..510b46cc 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js @@ -8,7 +8,7 @@ * @param {Object} res The Express.js response object * @param {Object} req The Express.js request object */ -export const hellWorld = async (res, req) => { +export const helloWorld = async (res, req) => { try { // Send a "Hello World" message in the response body diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js new file mode 100644 index 00000000..867a3111 --- /dev/null +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -0,0 +1,8 @@ +import express from 'express' +import { helloWorld } from '../controllers/helloWorldController'; + +const helloWorldRouter = express.Router() + +helloWorldRouter.get("/" , helloWorld) + +export default helloWorldRouter; \ No newline at end of file From 34e845b4a2758f55cf7929e87ae4a1cad4ee77b7 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 19:58:46 +0300 Subject: [PATCH 16/21] finally updated our app.js JS-MongoDB-TypeORM-NoAuth-Template --- .../JS-MongoDB-TypeORM-NoAuth-Template/src/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/app.js b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/app.js index 063906f9..d85463d8 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/app.js +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/src/app.js @@ -10,6 +10,9 @@ import "./config/db.config.js"; const app = express(); app.use(express.json()); +// Use Your Route here +pp.use("/api/helloworld", helloWorldRouter); + // rest of your code here From 93d79705a1ac915c21d4ec6fade62dd0f9fd3502 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 20:03:48 +0300 Subject: [PATCH 17/21] update JS-MySQL-TypeORM-NoAuth-Template --- .../src/controllers/controller.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/controller.js diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/controller.js b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/controller.js deleted file mode 100644 index e641c1a7..00000000 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/controller.js +++ /dev/null @@ -1,7 +0,0 @@ -export const controller = async (req, res) => { - try { - - } catch (error) { - - } -}; \ No newline at end of file From c50eebde8b2490750980eecd5381afb58490f4fe Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 20:09:42 +0300 Subject: [PATCH 18/21] added new controller hello world JS-MySQL-TypeORM-NoAuth-Template --- .../src/controllers/helloWorldController.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js new file mode 100644 index 00000000..b9364a86 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/controllers/helloWorldController.js @@ -0,0 +1,18 @@ +/** + * A simple controller function to handle requests to the '/' route + * @param {object} req The request object + * @param {object} res The response object + * @returns {object} The response object + */ +export const helloWorld = async (req, res) => { + try { + // Send a response to the client + res.send("Hello world!"); + } catch (err) { + // If there is an error, send a 500 error with a JSON response + res.status(500).json({ + message: "Internal Server Error", + }); + } +}; + From fb6d5f745df3fcee0cc195c3caa42a86b06e79a8 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 20:10:26 +0300 Subject: [PATCH 19/21] removing routes at JS-MySQL-TypeORM-NoAuth-Template --- .../JS-MySQL-TypeORM-NoAuth-Template/src/routes/router.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/router.js diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/router.js b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/router.js deleted file mode 100644 index 18b49770..00000000 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/router.js +++ /dev/null @@ -1,5 +0,0 @@ -import express from "express"; - -const routerName = express.Router(); - -export default routerName; \ No newline at end of file From 24614874fd9c15bcd3b1d569e3023c60fcc10c89 Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 20:15:10 +0300 Subject: [PATCH 20/21] added new Routes at JS-MySQL-TypeORM-NoAuth-Template --- .../src/routes/helloWorldRoutes.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js new file mode 100644 index 00000000..43619c06 --- /dev/null +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/routes/helloWorldRoutes.js @@ -0,0 +1,8 @@ +import express from 'express' +import { helloWorld } from '../controllers/helloWorldController.js' + +const helloWorldRouter = express.Router() + +helloWorldRouter.get("/", helloWorld) + +export default helloWorldRouter; \ No newline at end of file From dae9261887b28e6a92dc856e18a11a22bd38be4c Mon Sep 17 00:00:00 2001 From: Omar-Tood Date: Sat, 11 May 2024 20:16:30 +0300 Subject: [PATCH 21/21] finally updated our app.js AT JS-MySQL-TypeORM-NoAuth-Template --- .../JS-MySQL-TypeORM-NoAuth-Template/src/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/app.js b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/app.js index c9e45805..8e0e7c7f 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/app.js +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/src/app.js @@ -10,6 +10,11 @@ import "./config/db.config.js"; const app = express(); app.use(express.json()); + +// Use Your Route here + +pp.use("/api/helloworld", helloWorldRouter); + // rest of your code here