Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add catch-all route for SPA #1084

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Skanderloueti
Copy link

Description

Adding a catch-all route for serving a Single Page Application (SPA) from the backend allows you to serve the entire application from a single port, typically the backend port (port 8888 in this case), instead of running separate servers for the backend and frontend (on ports 8888 and 3000). This simplifies deployment and potentially improves performance by reducing network overhead. After adding this route, users can access the application through the backend port, and the frontend will be served seamlessly. However, it's essential to build the frontend application before deploying (using the npm run build command) to ensure that the frontend assets are available to be served by the backend.

Related Issues

No related issues this is a feature

Steps to Test

  1. navigate to the frontend folder cd frontend
  2. build the app npm run build
  3. navigate to the backend folder cd ../backend
  4. start the backend npm run dev
  5. open this link in the browser http://localhost:8888
  6. if it opens and you can login then everything works fine

Screenshots (if applicable)

Before:
Screenshot 2024-04-28 133725

After:
Screenshot 2024-04-28 133705

Checklist

  • I have tested these changes
  • I have updated the relevant documentation
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the codebase
  • My changes generate no new warnings or errors
  • The title of my pull request is clear and descriptive

Copy link

@yosrinajar yosrinajar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me except that you have to change the Dockerfile in order for it to work. Can you review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants