How To Connect React To A Backend (Express.js) - React for beginners #7
Why Stack Overflow recommends it
Stack Overflow users link it when someone is new to React and needs a walkthrough of wiring a React front end to an Express back end.
Recommended by 3 people across 2 different months, 2020 to 2022.
What it is
A beginner-oriented tutorial from Anthony Sistilli's React series (episode 7) showing how to connect a React front end to an Express.js backend. It walks through making requests from the React app to the server and on to external APIs.
What people said
Recommends Ozark19 · 2020-06 · Stack Overflow · on “Error 426 from newsapi.org once I deployed my site on Netlify”
[this video] This tutorial was a good start for me. I'm not sure what you're using for a front end but I used React for my project and it showed how to connect them. It will teach you how to make requests from your front-end to the back-end, and from the back-end to your API.
Recommends Miles · 2020-09 · Stack Overflow · on “Building First Large React Application”
I'm also new to React/Web Development, but for my projects I like to use a framework on top of React to make scaling easier. My favorites are GatsbyJS [LINK] and NextJS [LINK] . They are both 'static site generators,' in that the end result is static html/css/minimal javascript which loads really quickly. However, NextJS is cool because it's kind of in between a frontend and backend, in that you can use dynamic rendering or server api calls all within its framework so it can do more than just generate a static website. For what you're talking about, I think NextJS could be a good idea. You can definitely connect a React frontend to an Express backend, here's a youtube tutorial [this video] . In m
Recommends Code User · 2020-09 · Stack Overflow · on “Getting my express backend to make conditional api calls”
Can anyone help. I have built a webpage in react using the api from newsapi.org. The webpage conditionally calls the api depending on what is selected in the web page. The api calls have been structured as follows: const baseUrl = " [LINK] "; export const getNews = (path) => { const link = `${baseUrl}/top-headlines?sources=${path}&apiKey=${process.env.react_app_api_key}`; return axios.get(link); }; and export const getSearchNews = (searchTerm, sources) => { let link = ""; if (sources) { link = `${baseUrl}/everything?q=${searchTerm}&sources=${sources}&apiKey=${process.env.react_app_api_key}`; } else { link = `${baseUrl}/everything?q=${searchTerm}&apiKey=${process.env.react_app_api_key}`; } re
Cites Divyansh undley · 2022-11 · Stack Overflow · on “cannot post ; post can't be made with axis on react”
I am trying to make a post request in React to the server my React app is running at port 3000 & express app is running at port 9000 React: axios.post("/").then((response)=>{ console.log(response.data) }).catch((e)=>{ console.log(e.response.data) this.out = e.response.data }) Express: app.post("/", (req, res) => { console.clear() console.log(req.body) res.end("req") }) on the web console it says : "Failed to load resource: the server responded with a status of 404 (Not Found)" on the app 'postman' It runs just fine I tried to follow this YT tutorial [this video]