Edited: Why was learning Fullstack React confusing? - node.js

Update: When I first started with this question I was basically struggling to understand what I needed to do in order to make my frontend interact with the backend.
To answer my own question in case new guys come in:
If you use ejs, you are using server side rendering, meanwhile if you work your frontend separated your backend, you'll mostly be working with APIs.
First learn Node. Than work your way through on how APIs work. After feeling comfortable, start learning React.
Yes its normal. Just start building a project or else you'll stay in that tutorial hell.
So I have basic knowledge about React, intermediate level on javascript... and now I have taken a node with mongodb course. So I know that, i'll be feeding my tutorial hell if I do not put all those together and start building something from scratch. But till now, I have only rendered the EJS files and know how to setup everything from the ejs view point.
So now I feel quite lost as if someone gave me a puzzle with missing pieces.
I know some of you guys have taken this road so I have a couple of questions, even though some sound quite stupid:
How can node code be affected introducing reactJs, because I am currently using res.render('ejsViewFile')?
When you guys first learned this approach for using the MERN Stack, how did you learn to connect both of them? I find a lot of tutorials... but they confuse me even more.
Is this normal... me feeling like I have learned absolutely NOTHING?

It's great to see such type of questions.
I have also developed web application in which I have to just use the node JS and react with multiple microservices.
so I am also going through from such tutorials on udemy and other tutorials that are available on the website.
I found out that you can use react JS as a front UI and you can use node JS for backend if you don't want to use spring boot for your microservices it is just fine.
So basically I have developed rest API in node JS and using axios and promise I am calling that API from my react applications so I think in that way you can connect both of the applications.
in most of the applications I have seen that node JS is used for security purposes in the following purposes and then node JS is connected to a microservice it is just kind of adding another layer over your application.
I prefer lead can tell you that you can go through the udemy courses of react JS and it will show you how you can create a rest API on the node JS.
React for UI
Nodejs: api gateway or backend. You wish
Java : microservices, rest apis

Related

how to use websockets for simple game with chat

I am building this simple app that uses React and Node, for learning purposes. I want to use websockets for the game and for the chat.
websockets is new to me, and I am wondering if it is recommended to create two different instances for each purpose (game/chat), or should I use the same?
If you are building a simple app with react and node i would try the iosocket and there is tons of videos and similiar project on github where you can check it out to get a glimpse on how it works. Here is even a link to iosocket: https://socket.io/
You can read the documentation and try to implement these bits in your app.

How do React & NodeJS work together?

Can you tell me more about the relationship between the two? I want to (for example) write a little tool which plays audio files on my raspberry pi. Would I then do the player and the players interface completely in React, and then just connect to node in order to get the actual files?
Or, more generally but the same thing, if I would want to write an application that does certain things (writes files, records audio, changes system settings etc.) that would all be done in nodejs, but if I want to have an interface I would use something like React?
I am a bit confused, but I hope this question is valid!
Node and React can be used together.
There is even the MERN stack that helps with that:
MERN is a scaffolding tool which makes it easy to build universal apps using Mongo, Express, React and NodeJS. It minimises the setup time and gets you up to speed using proven technologies.
See: http://mernjs.org/
But you can use React with any other Node framework, not only with Express. React can work with any REST API so whatever you use to build a REST API can be consumed by the frontend written in React.
Some other options include: Hapi, Restify, LoopBack. For more see:
http://nodeframework.com/
from the official React Documentation React is "a JavaScript library for build user interfaces". In very watered down terms (and I mean watered down) React could be thought of as a templating library (please don't shoot me for that).
What I've learned about React is it is more like the "V"iew in MVC. It provides you a way to present the user interface using JavaScript and JSX. With the little I know about from various tutorials, I really like working with React.
Yes, this two thinks can work together, I am currently working at such project. I will point out main think here. That is where you put your routing. Does it goes to Node.js server or to React Router. This is important because it defines where you application logic should be.
ReactTS is a scaffolding engine for React on ASP.NET Core. Very powerful, and very fast - will generate your entire application with a single button click. You can also customize the templates. Check it out here... http://bssdev.biz/DevTools/React-Turbo-Scaffolding-Free-Download

How to build Restful API without using frontend javascript

I have been searching all over for a tutorial that could make a RESTFul API without using any frontend javascript to no avail. I am very new to Javascript/ web-development and have been doing many tutorials and mini projects to get myself acquainted with it.
This is a test for a job at a startup as they looking for an entry level developer. Their requirements are much different as they want me to use their in house build APIs.
What I am looking for is some help on how to get started building a RESTful API using node.js, express, Mongo and without using any frontend javascript. Thanks.
Recommendations for tutorials usually don't make good questions for Stack Overflow, but you might want to take a look at the following books. They helped me out quite a bit when getting started with Node:
Express Web Application Development
Advanced Express Web Application Development
RESTful Web API Design with Node.js
As others have commented, a REpresentational State Transfer API is implemented server-side. You could consume such an API from the client-side using JavaScript, but not build one on the client-side.
Express is a very popular web framework for Node, and you can certainly use it to build APIs, but you might also take a look at Restify. Hope that helps you out.

Using ember.js with node.js + express.js

After years of PHP/MySQL development on the server-side, I'm trying to explore new technologies for building modern web applications.
I'm trying to make an order between all the JavaScript stuff and, if I have understood well, a valid solution can be node.js on the server-side, express.js to handle routing and, for example, ember.js and/or knockout.js to handle client-side with MVC/MVVM, binding, observers. Is it a valid architecture?
I built a pretty straightfoward website at the following github location
https://github.com/bwship/neptunejs
It uses node for the server side and ember for the clientside. It is also using Parse.com for it's data and api layer. But, the general idea should all be layed out for you there, including what I feel is a pretty solid folder and file structure.
Let me know if you have any questions. I came from an ASP.NET background, and have just completely fallen in love with client-side MVC.

Building a web site with photo uploading possibilities with node.js

I'm new into Node.js and my intention is to build a web site similar (but way less complex) than Imgur, where uploading images is possible by dragging photos from desktop to the browser.
For this I want to use Node.js and MongoDB.
I have been looking around everywhere and found a lots of tutorials (many of them out dated) for setting up a database, but none for file uploading. Node.js and all it's modules is like a jungle, and it really isn't easy to know which modules to use in which type of context.
So, what I really could use here is some help with suggestions of tutorials and/or modules that may fit for this purpose. What is the easiest and best way to get started with this?
This is a school project that I need to do (I selected Node.js for server side myself, not knowing how complex it really is and now it's to late to change), so I would really appreciate your help here.
Thanks in advance!
You can get away without using most of the node.js modules aside from the mongodb driver. Express is a popular framework for web applications, but it might even be overkill here. Really, you just need to serve some HTML with the drag and drop code, and then be able to receive and serve images. It's probably less than 50 lines of code in actual node.js, plus whatever frontend code you have.
Check out this tutorial for the image upload portion on the node.js side using express:
https://github.com/visionmedia/express/blob/master/examples/multipart/app.js
Here's a tutorial for the frontend drag and drop functionality:
http://www.thebuzzmedia.com/html5-drag-and-drop-and-file-api-tutorial/
Update You might also consider http://mongoosejs.com/, which makes mongodb interaction a bit easier--but the native driver isn't too bad to use by itself.

Resources