I have a question already search on google but not find a good answer. What is the job of nodejs & ExpressJS in mean stack development ? Like is it some thing like php to create api and angular will call it ? Or something else
-
Node.js is the platform and express.js is the framework that is used to create a web applications on the top of node.js. Angular is the front-end web application development framework. – Ajit Soman Nov 01 '19 at 12:11
-
We create APIs with express.js and integrate those API in front end with Angular in MEAN stack – Ajit Soman Nov 01 '19 at 12:12
4 Answers
You're exactly right, Node.js is used in MEAN stack to create backend code and APIs that are called from a frontend Angular app.

- 3,252
- 1
- 18
- 18
-
Ok as we call apis in angular by http request this is the same way for node aswell ? And then what is the role of express ? – Umaiz Khan Nov 01 '19 at 12:11
-
Express basically just simplifies working with Node.js. It's a framework built on top of it. – Pavel Lint Nov 01 '19 at 12:12
Angular is the way to create an SPA (Single Page Application).
Wikipedia:
A single-page application (SPA) is a web application or web site that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server.
ExpressJS
What is Express.js. Express is a fast, assertive, essential and moderate web framework of Node.js. You can assume express as a layer built on the top of the Node.js that helps manage a server and routes. It provides a robust set of features to develop web and mobile applications.
So on top of node-js which is your server side application where you can build your apis that your angular SPA will consume, you have Express JS which is a ready solution to help you. This way, you will not need to solve problems like routing which have already been solved by the framework in an "optimal" or at least commonly agreed "good enough" way.
There is an excellent answer on express js in stackoverflow here

- 25,191
- 4
- 32
- 61
Yes, you right it is like so. NodeJs is used to create a server, then APIs and Angular call those API from the Front-End.
Detailed Description:
What is NodeJs
- You can create a server using NodeJs where you will have a bunch of APIs.
These APIs can be called from an Angular app.
Official Definition
: Node.js is a runtime environment that executes JavaScript code outside of a browser. Outside of a browser means Server.
What is ExpressJs
- ExpressJS is a prebuilt NodeJS framework that can help you in creating server-side web applications faster and smarter.
- Note: It is not necessary to use ExpressJs if you are using NodeJs.
What is Angular
Angular is a framework for building Single Page Application(SAP) web applications.
SAP means your site does not reload the page when you move from one page to another.
- Your Angular app calls NodeJs API.

- 6,755
- 3
- 34
- 52
Angular is a library for building Single Page Applications which (typically) run inside a web browser.
Node.js is a way of running software written in JavaScript outside of a browser. It has many uses.
Software written to run under Node.js — that is strictly relevant to the topics you are asking about — includes:
- Build tools used with Angular (converting code is written in ways optimal for developers to edit and debug to ways optimal for delivering to and running in a browser).
- Other helper tools for software development (such as @angular/cli which creates a skeleton set of code for an Angular project)
- HTTP servers used to provide web services (a type of API) for client applications (which may be written in Angular) to access
Express.js is a library for Node.js which provides prewritten solutions for many of the tasks an HTTP server needs to perform.
You can write many kinds of software in Node.js. I have some code lurking around that loops over all the images in a directory and spits out a PDF of them. It doesn't even go near the Internet.

- 914,110
- 126
- 1,211
- 1,335