Should you use a backend with a headless CMS? - node.js

Im building a website in school and we need to use a headless CMS to manage the website when it's finished. Im using react on the front end.
My question is can i use a backend server like node js with a headless CMS or would that be unnecessary / not make sense? Im learning node and graphql in school atm and wanted to implement that to this website, could i do that alongside with a headless CMS?
Tanks for answers!

Yes, using NextJS for example. This adds a serverside part to your application.

Depends whether you're building headless cms yourself or just using available options like Strapi or others.

Related

How can I create a mobile applications which react that can also serve as a website

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

Can't we SEO Mern Stack Applications and reactjs Applications?

I am a newbie to development and I recently created a MERN Stack Application which uses reactjs as the frontend, Nodejs with express as the Backend, and MongoDB as the Database. After that, I searched for some methods to SEO this application. But in many articles on the internet, they have mentioned that we can't SEO Reactjs applications and instead we need to implement SSR(Server side rendering). So now I have the following questions. Could someone explain these, please?
Can we upgrade the existing MERN application to NextJs?
Is there any other methods to SEO this MERN Application?
So do I have to prevent using React as the frontend in my future projects? Instead, do I need to use Nextjs definitely in my future projects? If so reactjs is useless?
Thank You.
Surjeet has covered your first question nicely. In answer to you second and third question there are tools such as React Router and React Helmet which can add some SEO to a React project. There's a helpful article about it here:
https://medium.com/#prestonwallace/3-ways-improve-react-seo-without-isomorphic-app-a6354595e400
The quick summary is that React Router will allow you to generate a uri for each new route. React Helmet creates metadata tags in the header of a component such as a title or the description of the page, which googlebot can then pick up.
Yes, You cannot do SEO of a react application. You have to use SSR for it.
Answers to your questions:
1. Can we upgrade the existing MERN application to NextJs?
Yes you can but it's a lengthy manual process. All of your components you can use directly. There are many things you need to change:
Routing (NextJs has a different way of routing)
Way of Importing Styles
Run Scripts in package.json
If you have used browser things like window object, localStorage then you have to handle those in SSR
And there may be other issues you might face while running the app
2. Is there any other methods to SEO this MERN Application?
No, SSR is a must
3. Do I have to prevent using React as the frontend in my future projects? Instead, do I need to use Nextjs definitely in my future projects? If so reactjs is useless?
Go with NextJs if SEO is a must and you want SSR (Ex: E-Commerce Site, Personal Site)
Go with React if no SEO (Ex: Admin Panel, Specific User-based Web App)

Node.js / Express.js / ejs + WordPress or any CMS

I have a question about CMS, currently I developed a website on Node.JS server using Express.Js and EJS.
The thing is I'm pretty bad for webdesign and I want to know if it's possible to use CMS like Wordpress to construct my FrontEnd ?
I read than WordPress using Apache/php and couldn't work with Node.
Thanks !
You can use Gatsby for example, will allow you to use the API from most CMS and use them in your own React app

Adding strapi to an express server

I want to build a self-hosted website with nodejs and the express framework because I'm already familar with that. However, using a CMS for this project is a requirement, so I'm looking for a suited and easy-to-use/-learn CMS and discovered strapi which I quite like.
Setting up an API with strapi is easy indeed but now I'm struggling with adding strapi to an express server. My goal is one express server with strapi, which also hosts the website. So, I can control the routing with express (which I'm used to) and can render the site on the server.
Can somebody explain me how to do that and maybe give a small example? The examples I found, are only about hosting the API externally and using a client-side web framework or a static site generator.
Or is my vision not possible with strapi and I should use another CMS like KeystoneJS (which is already built on Express)?
Thanks in advance!
Using Express with Strapi must be very complex and does not really make sense.
Strapi is based on Koa, which has been designed by the team behind Express. If you are coming from Express, eyou will get confortable with Koa very quickly. Here is the documentation: https://koajs.com.

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

Resources