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.
Related
I just finished my JavaScript course and I understand pretty well how things work.
I have started my React journey with a project in mind
So I want to create a mobile application using React Native and I also want that same application to be a website with domain and url since I want the website to work with with Google adsense.
I'm a little bit confused about things cause I want to use mysql database, node for back end and React for the front end, but I don't know if this is possible to just create one application that work as both mobile app and a website.
Thank for your assistance and advice in advance.
A way to use practically the same code for a web frontend and mobile app is using tools like Capacitor. It make it quite simple, and also allow you to use some mobile native API's.
Here's how to integrate it with react js Using Capacitor with React
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
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
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.
I am interested in develop a rt module for my website with socketstream + node.js. I am only interested in do the server side in socketstream, not the client side. How can I access the socketstream from a normal php/html app, wich js i have to include ? I am mainly interested in rpc, pub/sub and authentication/session.
I would not recommend doing this, as it is unorthodox.
That said, I do recall that someone wanted to use an early version of SocketStream from within their application, which was built on the .net platform. It turned out that they got it to work by embedding the SocketStream app's web page inside of an iframe.
Check out to this framework:
http://www.socketstream.org/
Comes with a lot of examples and it's easy to use.