chargin partial web page with node express and EJS - node.js

I need help to charge my web page partialy, for example I want to listen music in a player while I am changing betwen different content. For my project is necesary to do this with node Expres and EJS but at the moment I can not find any module or solution for this. Any advice?
Thanks.

Express is a server side technology. As far as I understand what you want to achieve is single page web application. Try using client side Single page web application technologies like Angular or Backbone etc.

Related

React and Express Routing and Views

I'm a newbie in web development. I built a project before using Node, Express, and EJS (as my frontend) and now, I am trying to make another one using React as my frontend.
I watched and studied a lot of React + Express tutorial videos in Youtube but I think every video only shows a one-page site.
My question is how do I handle the routing of Express+React? Where should I put the routes and render multiple pages or views? Should I put it in the app.js under the Node folder? Or should I create another folder under the React app consisting of the js files for different views?
Thank you. I would gladly to answer questions if my post lacks information.
There's an interesting hand to it.
App
__|__
| |
Frontend Backend -->Database(MongoDB)
I think this scanty tree should do justice to it.
I'd suggest you use MERN
MongoDB
ExpressJs
ReactJs
Nodejs
Your apps need to be on different servers. This method is effective and secure.
Since you already know React, Express, Nodejs... You can check out this link (by cleverprogrammer)to see some MERN projects and how each part of the app communicates with one another seamlessly.
https://youtu.be/ktjafK4SgWM

Whats the best way to integrate 2 different react projects?

I Have a huge react project which requires a chat app.
I've now already made this chat app using react-chat-engine.
Now I want to integrate this chat app with the Main app. I can put it in the same app and route to it sure.. but...
I would like to use the same chat app for another application which will use similar database.
Other than iFrame and <a href.. is there any other way? Which is hopefully quicker to load
I think that you can use React.DOM.render(<App>, document.getElementById("root")) on different div then #root and you should have two react apps in one HTML

is react supposed to be used on top of handlebars with node.js?

I want to use react on my node.js website. Im using express and handlebars with this website. Is react supposed to be used on top of all that? Or should i not use handlebars or express with react?
Also what is your opinion on node.js? Is it a declining technology? Is there something else that is better for me to use?
React is a view library. Is mean to be used to build your entire ui.
Then you have two options you can use it to build a SPA - single page application - and consume data through network request to your server or render multiple pages each of those will be a react app.
Node + express are backend tech that can help you to build the server side of a web app here you can create some api endpoints to return data to the server and comunĂ­cate with the database.
Node is a very good choice as is still and will be used for long time and many companies.

Why use Express with ReactJS

I'm currently working on a new ReactJS application. In all the previous applications I've built I used Express for the server side rendering. I used Express because routing in production mode wouldn't work if I didn't.
So I've recently discovered that it's posible to just always redirect my React app to my index.html file and let the React routing just do it's work. This also works when I deploy my application to production.
I know Express can be usefull for SEO porposes but other than that I have no idea why I would need to use it. So am I just missing something? Or is it just fine to don't use Express with my React application if I don't need any SEO.
React configured as a Single Page App, renders the express routing all but unnecessary. The standard transition from a web server rendered app to a single page app is to change the server into a REST Web API and any server side data needed from the React App is obtained through AJAX calls.
So in most cases you don't need Express when you are using React to handle your routing except for in less common cases when you might want to use express as a reverse proxy or something.
If you want to do server-side rendering, you'll need a node server (typically but doesn't have to be express) to render your React components. This could not only help with SEO but also allow your page to appear to load faster (you wouldn't have to wait for the JS to download and run before the user sees the HTML).
If you don't care about the benefits, don't use SSR.
when deploying react application it is just usually an html and a JS file. So you need some kind of server to host it. Luckily there are services out there that offers that like S3, Github etc.
You're using Express because it can host the html and js files. So technically you don't need specifically express but you need some server that will host your files.

node.js web application with client side rendering

I'm building a web application using node.js, this is my first time working with node. I'm using express framework and I have a question about client side rendering.
All the tutorials that I have found online talk about express and server side rendering. They talk about how you can use jade the express templating engine, to serve rendered templates as reponse to your web application.
My application is going to be client heavy and most of the rendering will be done client side. I want to call server to just get plain JSON response and then render it client side, so server side rendering is not of much use.
In this case, is express a right choice? I really like the way I can write APIS in express but I'm concerned about how to serve my application. If I don't want to use the server side rendering it would mean that I would have to serve static HTML at the first call which seems weird to me.
You might want to try Emberjs if you want most of the work done on the client side. But still, you need to send the data to the client so one way is to build your app totally on the client side just by sending a plain html and working your way up there. You can also precompile jade
What you are describing sounds like you are searching for an javascript MVC(or other) solution.
There are a lot of possibilities. Take the right tools for the right job.
Try the following link to get an nice overview of what is possible.
Helping you select an MV* framework

Resources