What is Routing?
Routing defines the way in which the client or front-end requests are handled by the application endpoints ( Server SIde ).Routing in Node.js
Download Node from here https://nodejs.org/en/
Implementation of routing in Node.js: There are two ways to implement routing in node.js which are listed below:
- Framework
- No Framework
But We will use Normal Routing in Nodejs . Which will be used for CRUD Operation.
Now the below routing is used for CRUD REST API . Get the Full Project Downlead the CRUD in MERN
const express = require('express'); const router = express.Router(); const employeeController = require('../controllers/employee.controller'); // get all employees router.get('/', employeeController.getEmployeeList); // get employee by ID router.get('/:id',employeeController.getEmployeeByID); // get Detail by name router.get('/searchRecord/:first_name',employeeController.getEmployeeByName); // create new employee router.post('/', employeeController.createNewEmployee); // update employee router.put('/:id', employeeController.updateEmployee); // delete employee router.delete('/:id',employeeController.deleteEmployee); module.exports = router;
Subscribe to My Programming YouTube Channel Before Downloading the code :
Read Our More Tutorials
Live Search with React and NodeJS
CRUD Operation Using React & Nodejs