Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Why do we need Express server when we have a backend ready already

I am quite new to javascript and web application environment. I have seen a react web application project which had a public directory, a client directory and a server directory. I have few question

  1. Why do we need an express server file setup in the frontend project if we already have backend APIs ready and backend server ready

  2. Do we need an express server if we make the frontend on react and call the APIs to fetch the data for application.

  3. Isn't the backend server and express server in the frontend project are same?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Why do we need an express server file setup in the frontend project if we already have backend APIs ready and backend server ready

You don't.

You need an HTTP server to listen for and respond to any Ajax requests you make from your client side code.

You need an HTTP server to listen for and respond to any requests for the HTML documents and static resources (JS, CSS, images, etc) that your pages need.

These can be the same HTTP server, different HTTP servers, written with Express or not written with Express.

React tutorials tend to ignore mentioning this and just dive in showing how to use Express for everything. Don't read too much into that.

Do we need an express server if we make the frontend on react and call the APIs to fetch the data for application.

No. See above.

Isn't the backend server and express server in the frontend project are same?

Maybe. It is up to you. See above.

over 4 years ago · Santiago Trujillo Report

0

There is no such thing as a "backend server" and a "frontend server", a simple web application is composed of two main parts:

1/ an application that serves html pages, which runs on a backend, so it is usually called a server, but a typical cloud server nowadays can run hundreds of different serving apps at the same time

2/ a frontend, which is typically a complex piece of JavaScript software and html pages that are dynamically send to the user browser and execute locally

The minimum that you require to have a working website is a server application that will return one or several html pages upon user request. A typical React + Node project is organized as follow:

  • A server directory: which contains all the code for the serving app - the one returning the webpages, it can also contains code that handle the REST API, in case your client app requires dynamic data or if your server connect to a database. Note that the webpage server and the API server could be two different- or more - applications.

  • You usually dont want to share to users your server code, so typically you have a public directory that contains the html pages and this is the only location on the disk - theoretically - that can be access by users. This directory can also contains required images and resources needed by the webpages, it is also called static resources

  • To keep thing more organized, the code of the frontend application is placed in a client directory but on production is usually bundled in one or few files, depending on the size of the app, and also placed in the public directory, so it contains everything needed to serve the app.

Hope it helps

over 4 years ago · Santiago Trujillo Report

0

We don't need an Express server, however, adding it comes with great benefits:

  1. It helps add compression to an angular / react application that uses only in-memory server (if that is your case).

  2. Defines base path where to serve static files for your project and can also add gzip compression headers for each of the request so that the server returns the compressed versions.

  3. Helps you parse your API calls to the correct format expected by the UI so that the parsing logic stays in the express server and not the UI. This is helpful in the event that the API response changes in the future, or when the final backend endpoint changes, no need to modify the UI, but the route in the express server.

I have found out these and other benefits while looking how to add compression to an angular application (turns out you cannot without express or an actual web server).

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!