Tuesday, June 18, 2024
Express JsNodejs

Node Js – Routing Simple and Easy with Express

Node Js - Routing Simple and Easy with Express

Hello to all, welcome to In this post, I will tell, Node Js – Routing Simple and Easy with Express.

Now a days, I am learning node js and What I do learn about node js, I share on my blog.

Nodejs is an open-source server environment which runs Javascript on the server and Express is a web application framework for nodejs.

Today I share about routing in node js with express js

Here is the pictures for routing pages:






Here are the working steps, you need to follow to add routing in node js:


1. Very First, you need to add express into your nodejs application:
$ npm install express --save
2. Second, you need to below code into your node js main file:
var express = require('Express'); // Import Express Package after Install it.
var app = express();

app.get('/about', function(req, res) {
  res.send('About Page');

app.get('/', function(req, res) {
  res.send('Home Page');
app.listen(3000); // Path Define localhost:3000

If you have an query related to this post, then please do comment below or ask question. 

This is my custom code and If you want to work with nodejs, then you have to install node js  first after it,  you can try my above code.

I want your thoughts on it because it is very important for me.

Thank you,

Happy Coding


the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.