Nodejs and Expressjs difference - node.js

What is the difference between nodejs and expressjs and
Is it possible to create webpage only using nodejs?

Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. Node allows you to write and run Javascript code server-side.
Express.js is a framework for Node.js. Basically instead of writing 20 lines of code for a simple functionality with Node.js, you can write it in 2 lines using Express.js.
You can write the webapp using Node.js, but I don`t recommend it. Express is a minimalistic framework and it will make you life easier.

Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. Node allows you to write and run Javascript code server-side.
Express.js is a framework for Node.js
Express is built on top of Node, so yes Express adds more features. Node is just a Javascript environment with libraries to make it easy to write software, where Express extends Node specifically to make webservers easy to write.
Express/Connect adds the concept of middleware, a simplified way of managing different routes, automated integration with several templating engines and a bunch more.
All nodejs framework in here
Help it help you.
Thanks.

Related

difference between node.js and express

I'm new to the front end development and modern technologies MEAN/MERN stack, I am confuse about difference between node.js and express can someone outline differences or advantages
and one can learn express.js directly or it's a pre requisite to learn node.js first?
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. It is used to run JavaScript in ways similar to how the browser runs JavaScript but on servers. Express is a library (called a package in the Node.js ecosystem) that makes it really easy to build APIs or serve files.
Node.js is a platform for creating server-side event-driven I/o application using javascript.
Express.js is a framework based on node.js for developing web-application using principles and methods of node.js.
In simpler terms, express.js makes handling API requests and server management easier than using only node.js
Express js is built on top of the Node.js framework.
Express js uses node.js itself and provides more features to build applications on top Node.js
Node.js: Node.js is a Javascript runtime environment for executing Javascript code outside of a browser.
Express.js: Express.js is fast and light-weigh framework for building web applications.
You should first learn Node.js and it's core modules like path, fs, os, events and others.
After that you should learn asynchronous Node.js like callback, Promises and async/await.
Then you should learn express framework.

Typescript + Node + Express?

After stumbling upon the typscript-node starter released by microsoft, i started to get lost.
Can we really replace node with typescript on the server? There are several serverside things that TS does well:
- Creating a web API service with express
- Managing the CRUD queries with mongoDB
And much more...
I am used to generate an api with node and connect angular to that api. Am i wrong?
Should we switch to TS on the backend and forget about writing node code on the server?
Typescript is a (or rather, a superset of) language - not a runtime. It is the equivalent of Javascript except it needs to be compiled to run on the Node.js runtime.
You can write the backend with Typescript if you want, and then run it through ts-node, or just compile down to ES6 via tsc and then run it with standard Node (v8+ is recommended). This is what I do with many projects. It is still "node code", it just has all the benefits (and gimmicks) or Typescript.
I recommend the library meseret to manage your typescript node.js backend code. It has support for Koa, Mongoose and Socket.io, with many builtin configurations. It is a great way to manage things in one place, using TypeScript throughout your project.

How does Express.js relate to Node JS?

I'm seeing several responses of comparisons of Express vs Node, what each is/does but still a little unclear how one relates to the other.
Wondering if this would be a good analogy?
JavaScript : jQuery = Node.js : Express.js
Node.js is a platform for building server-side event-driven i/o application using javascript.
Express.js is a framework that is based on node.js for building web-application
node.js is a Javascript runtime environment that comes with a ton of libraries.
Express is a Javascript library that runs in node.js and offers advanced features for configuring and running a web server.
So, you can have a web server in node.js without Express (the built-in http module offers a simple web server), but you cannot use Express without node.js since Express runs on top of node.js. Express adds many more features (such as routing and middleware and tons of compatible add-ons) over the built-in web server.
Your analogy of Browser Javascript ==> jQuery as compared to Node.js ==> Express is a good comparison. jQuery adds DOM manipulation features to regular browser Javascript while Express adds web server features to regular node.js web servers.

Development workflow on Sinatra/React application

First off, I'm relatively new to Rails and Node.js development, so please forgive me if my explanation lacks the correct terminology.
I'm using Sinatra for the routing and API because its easy for me to understand vs. writing the API in something like Express. For the client side, I'm using React and making calls to the Sinatra API to get the data.
During development, I run the Sinatra backend on a port (running rackup. And separately run the client side w/ Express on a separate port. I use gulp to transpile the jsx.
What I'm wondering is if this workflow makes sense? Is there an easier way in which I could build everything using rackup including transpiling the jsx?
Would I be better off just building the front and backend API using Express?

Is express similar to grunt? what is the difference? what are the advantages of express over grunt?

I've been working on node,grunt,bower and yeoman from couple of months. I came across MEAN stack applications, in which expressjs is providing the server environment(my understanding). Are both grunt and express similar?
Requesting for some helpful link on express and MEAN stack.
Express is a webserver framework on top of nodejs (like symphony for php).
Grunt is an automation tool (like make or gulp) and not a webserver.
The only thing they have in common is, that they use the JavaScript programming language.
MEAN is a full stack environment for developing web applications. MEAN uses MongoDB as database backend, Express as webserver framework, AngularJs for the client side and all is based on NodeJs. When your application gets more complex and you need some sort of deployment procedure you may use Grunt to automate this.

Resources