Skip to content

REST API based web application for educational purposes. The API provides endpoints for ordering books from book store

Notifications You must be signed in to change notification settings

ADv0rnik/request-emulator

Repository files navigation

Python 3.10 GitHub language count Python 3.11

Bookstore emulator

Small REST API based web application for educational purposes

Usage

The application require Python version 3.10 or older and Poetry. In order to install the application on your local machine go through the following steps:

  1. clone the repo using comand
git clone https://github.com/ADv0rnik/request-emulator.git
  1. Install and activate virtual environment. For UNIX-based systems:
   python -m venv venv
   source venv/bin/activate
  1. Run installation of dependencies poetry install
  2. Run command source aliases
  3. Run command run_emulator

The docker will run the start_app.sh script. While running the application for first time, make sure that LOAD_FIXTURE flag is set to True. This will allow to upload an initial data into database.

Test

  1. From root directory run command run_emulator_test. This will execute docker compose instructions
  2. To check test results run show_logs
  3. Remove test containers by following command stop_tests

Installing pre-commit hooks for tests

  1. While on your local machine run install-hooks.bash script from .\scripts directory to set up the configuration
  2. Git will run the pre-commit script each time you commit some code to remote repo

Alternatively tou might create a pre-commit hook directly inside .git/hooks directory to be triggered on commit event

Deploy to Railway.app

  1. Create a PostgreSQL instance in your railway.app account.
    • Copy-paste credentials from railway.app into your .env file
    • Run command alembic upgrade head
    • Run command python run_db.py
  2. Create an application instance (choose a GitHub Repo for deploy)
  3. Copy and paste variables from .env (Note: host and port for application must be 0.0.0.0 and $PORT respectively, where $PORT - name of variable)
  4. Deploy will run automatically triggered by applying changes

About

REST API based web application for educational purposes. The API provides endpoints for ordering books from book store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published