Skip to content

Commit

Permalink
added helloWorldRouter in mongoose template #347
Browse files Browse the repository at this point in the history
added helloWorldRouter in mongoose template
  • Loading branch information
sharafdin authored Apr 24, 2024
2 parents 2b15431 + a5df6d4 commit 520fb98
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import cookieParser from 'cookie-parser';
// import your files
import { port } from './config/initial.config.js';
import connectDB from './config/db.config.js';
import helloWorldRouter from './routes/helloWorldRoutes.js';

// Initializing the app
const app = express();
Expand Down Expand Up @@ -42,7 +43,7 @@ app.use(express.json());
connectDB();

// Use your routes here
// app.use('/api/', authRoutes);
app.use('/api/helloworld', helloWorldRouter);

// Global error handler
app.use((err, req, res, next) => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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",
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import express from "express";
import { helloWorld } from "../controllers/helloWorldController.js";

const helloWorldRouter = express.Router();

helloWorldRouter.get("/", helloWorld);

export default helloWorldRouter;

This file was deleted.

3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 520fb98

Please sign in to comment.