Skip to content

igokul1973/api.blog.didgibot.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog backend

Backend for blog.didgibot.com

Prerequisites: (Also see requirements.txt in the project's root):

  1. Python >= 3.12
  2. FastAPI
  3. MongoDB
  4. Strawberry (GraphQL)
  5. Docker and Docker Compose (optional)

Development

Installation

Docker and docker compose are recommended for development purposes.

  1. Open your terminal and clone repository.
  2. In the root of the cloned project copy cicd/.env.dist to cicd/.env.
  3. Set up your own env vars in the cicd/.env file and/or accept defaults.
  4. Run docker build --progress=plain --no-cache -t <your tag here> -f cicd/Dockerfile .. It will build FastAPI docker container.
  5. Switch to cicd directory.
  6. Run docker compose up and wait until application starts.
  7. Run docker compose ps to make sure all containers have started.
  8. Run docker compose logs -f and make sure all is running as expected.
  9. Open browser at http://localhost:<your mongo express port from .env> and see if you successfully connected to MongoDB.
  10. Open browser at http://localhost:<your backend port from .env>/docs and see if it serves you the API documentation (OAS 3.1).
  11. Check if the data folder in the root of the project now contains the MongoDB files.
  12. You should be all set.

Development procedures

The app starts in Docker and you're now able to change the code which reloads automatically with every saved change thanks to uvicorn's --reload flag.

Debugging

The codebase ships with .vscode folder that contains the launch.json file. The file contains the "Python Debugger: Remote Attach" configuration that would allow to set breakpoints and debug the application inside VSCode. For any other IDE's - please find an appropriate documentation.

Please note that docker has opened a debug port (which you should have set up in the .env file) - please consult .env, docker-compose.yml. If you accepted defaults while setting up the .env, the debug port should be 5690.

About

API for didgibot blog

Resources

Stars

Watchers

Forks

Packages

No packages published