Using generated express app as backend in Angular 12 - node.js

thank you for visiting my question. i was learning web developer by myself since 2020 (i have no mentor and all of my teacher is you, guys!). my path is to be a MEAN stack.
i have learn about fundamental HTML, CSS, JS Native, Bootstrap, SCSS and currently i was learning about JS Framework (Angular) and i was learning NodeJS and simulating a simple CRUD with mongoDB (NodeJS is not using Angular, EJS instead). btw everything i do is through local machine!
i just curious how it looks like attaching NodeJS in our ng project. i have tried to integrate it but because of lack information i still fail to integrate between those two.
and can we use generated express app which is comes by using command
ng add #nguniversal/express-engine
i still have doubt on how to do it correctly or if it was answered, may you refer the related article so i can learn from it? thanks in advance <3

Related

Does the default Reactjs application use node.js?

This may be a dumb question, but is the default react app (created using npm create-react-app my-app) using node.js? I am confused because in my web development class at university, I had to download node.js to create react applications. However, I didn't have to do anything like creating a server or initiating a node.js file, which is described in w3school's node.js tutorial. Because of this, I found out that I don't even really know what node is used for, besides downloading packages like redux and whatnot.
create-react-app uses node.js for all of its dev tooling. Likewise, a lot of the tools you'll use in the React ecosystem (like webpack, prettier, npm), all run on top of node.js as well).
You'll most probably build your react app to a static file, in which case the production output will not require node.js, it will be html and javascript assets that can be served directly to a client.
Hope that helps! Let me know if you have other specific questions
Node.js is used for server-side while React.js is for the front-end part. So, no, you don't need Node.js.
Under development mode, yes. Create react app runs NodeJs with Webpack Dev Server to allow you get feedback when modifing files, start or stop the server.

What is the difference between working express vs next.js with strapi

I am new to nodejs development, the fist thing I started to learn is express but I was looking for CMS functionality so I found strapi.
Is strapi something that can be added to express or is it a stand alone app. I worked will php and MVCs.
My first project using node is to creating a website that I can change the contact (CMS), forms with verification and a simple blog with with tags.
what is found is next.js and strapi can work together
if this question was accepted then my question is not general
What are the differences between Koa and Express 4.0?

Difference between create-react-app with backend node.js server and create-react-app without setting up node.js server

From udemy React courses i could see Brad Traversy using create-react-app with node.js backend server and Andrei Neagoie using only create-react-app without node.js server to develop a full stack product.
I am seriously confused with when to use what?
Can any one explain me between these two scenarios? Please?
This is mostly related to how you want to structure your code. You can either :-
Set up your front-end and back-end code together. So, in your script tags in package.json, you will have something like 'nodemon server.js && react start' (refer package.json for exact syntax) to start both front-end and server with 'npm start'
Setting up front-end and back-end separately.
This is preferred for separation of concerns. In this case, you would start each separately.
Also, your front-end shouldn't be concerned about how your backend code has been written. It should only be dealing with backend using an API.
For ex: if in future, you wanted to change to Deno.js instead of node.js server, you would have make some modifications in package.json if you had front-end and back-end code written together in folder.
As far as deployment is concerned, in this case also, it will help if you kept the front-end and back-end code separately so you can deploy them separately.
React is used for frontend, while node.js is used for backend.
I think your confused because one is using react with node.js the other is using react alone.
Well React can be used for other backend other than node.js, like php for example.
This means you can create an app using react/php.
The reason Brad Traversy is using create-react-app with node.js because he wants to use node.js for his backend.
While Andrei Neagoie is using create-react-app without node.js because he either:
Don't want to use any backend.
He will add backend later on.

How to build a UI with typescript/NodeJS

I'm absolute new to this topic. I want to learn Typescript using NodeJS and have some simple questions. NodeJS is working with Javascript, as far as I know, but how do you get an UI? Do you have to create a HTML/CSS Webpage and run it with Typescript? How do you get Images, Options, Buttons in Typescript? How are they implemented in the Code? I found a lot of Tutorials, but they just return "Hello World" and I don't think I have to "write" the whole page in an output in Typescript.
NodeJS is pure server side javascript, you wont build the UI with it, you would serve the html/css/js to the client, and maybe create an API to communicate with the client.
I assume you dont need an example how to create a Node project, as you stated to have read some tutorials about it.
For starters, i would advise to go for NodeJS plus Expressjs on the server, then maybe start to serve simple static websites (like a handwritten 'index.html'). Expressjs makes development especially in the beginning a lot easier. Serving static files would just need something like
app.use(express.static('public'))
..in your server code. If you navigate then to e.g. localhost:3000/test/route, it would look for the /test/route/index.html in your public folder (which should be in your project root)
Then use a framework for client side development.
If you want to use Typescript for the development of the client side of the app, you might want to look into Angular. It is pretty tightly bound to Typescript, but the learning curve is pretty harsh if you are a beginner with this. Other client side frameworks that work well with Typecsript pretty much out-of-the-box or via cli are Vue.js and React, just as examples.

Node Js and Express: Where can I find free simple projects to learn and read the code?

I just completed basic tutorial about Nodejs and Express. Where can I find free simple projects to learn and read the code that will cover much of nodejs and express?
Sign up for freecodecamp it's a open source project to learn fullstack Javascript (frontend, data visualization with react.js and backend with node.js and mongodb) it has free tutorials and real world projects to do. Once you complete the all projects you can work on real programming problems for non-profits to build your portfolio.
If you don't know them already, maybe these might be useful:
https://github.com/wercker/getting-started-nodejs
http://amirrajan.net/nodejs-by-example/
Other than that, I am permanently learning tons of stuff by looking at the npm packages in the node_modules folder. Especially by reading the tests.

Resources