irctc-backend

Backend for a train reservation System using FastAPI and MySQL

APACHE-2.0 License

Stars
5

backend

Inital setup for project

- checkout to dev branch
- git clone <url>
- pip install virtualenv
- cd backend
- virtualenv venv
- venv\Scripts\activate (windows)
- source venv/bin/activate (UNIX systems)
- pip install -r requirements.txt

MySQL Database

You need a mysql server running on your machine. Therefore, make sure you have an instance of mysql running. Furthermore, you now need to create the railway_system database, you can name it as per your wishes. After this, follow the steps:

  • Go to db and run each .sql file starting from railway_system, views, triggers, data.
  • Create .env file and fill the parameters accordingly. It should look like this
    MYSQL_DATABASE = "<your mysql db>" MYSQL_USER = "<your mysql user>" MYSQL_ROOT_PASSWORD = "<your mysql password>"
    Now you will be able to acess the database.

Run the backend

- uvicorn main:app --reload
- open http://localhost:8000/docs

Testing

- open http://localhost:8000/docs

Subsequent updations

- git pull
- venv\Scripts\activate (windows)
- source venv/bin/activate (UNIX systems)
- pip install -r requirements.txt

Interactive Docs


FastAPI GUIDE

https://fastapi.tiangolo.com/

AWS GUIDE

SQLALCHEMY GUIDE

https://docs.sqlalchemy.org/en/14/