This is a starter template for a NextJs frontend with a FastAPI backend.
You can develop the frontend and backend separately.
To call the backend from the frontend, just prefix the endpoint with /api
.
const res = await fetch('/api/hello')
-
NodeJS
-
Python
- Frontend
On the root folder:
First Time
npm install
Run
npm run dev
- Backend
In the backend folder:
First Time
pip install -r requirements.txt
Run
uvicorn main:app --reload
On development, because of the CORS, you need to run browser with security disabled.
(VSCode configuration is already set to run Chrome with security disabled)
- Docker
docker-compose up
It will run on port 8080.