Skip to content

paractmol/monorepo-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Monorepo app

Backend and frontend that can be deployed to a render.com as static and web app.

Backend

pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 10000

CORS middleware

CORSMiddleware allows you to specify which origins are permitted to access resources on your server, what methods are allowed, and which headers can be used. This is essential when your frontend and backend are hosted on different domains.

from fastapi.middleware.cors import CORSMiddleware

app = FastAPI()

# Add CORS middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # Allows all origins, change to specific origins in production
    allow_credentials=True,
    allow_methods=["*"],  # Allows all methods (GET, POST, etc.)
    allow_headers=["*"],  # Allows all headers
)

Frontend

Make sure to define environment variable REACT_APP_BACKEND_URL

yarn install && yarn start

Deploy static react app: https://render.com/docs/deploy-create-react-app

How to deploy it to render.com:

https://youtu.be/888vl8K_rNM

About

An app to demonstrate how you can deploy a static website and web app to render.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published