Skip to content

cameronthecoder/error-monitoring-api

Repository files navigation

Error Monitoring API

Code style: black

This repository contains the backend code for the error monitoring project.

Table of contents

Overview

Project Architecture

an image of the project architecture that contains a frontend app, a backend app, a third party application, and a PostgreSQL database

Framework and Packages

This API uses the following framework and extensions:

  • Quart - Quart is an ASGI Python microframework similar to Flask. Quart supports full asynchronous code.
  • Quart-Schema - Quart-Schema is an extension for the Quart microframework. It allows validation of incoming and outgoing data (usually JSON) against a Python dataclass. Quart-Schema also generates swagger documenation so other developers can interact with the API with ease.
  • Quart-CORS - Quart-CORS is an extension for the Quart microframework. It enables and controls Cross Origin Resource Sharing (CORS).
  • Databases - The databases package provides a wrapper around the SQLAlchemy Core language and provides support for PostgreSQL, MySQL, and SQLite.
  • Black - The black formatter formats code to the PEP 8 style guide.

How to run the app

  1. Clone or download the respository

  2. Open the repository in your terminal by using cd

    cd error-monitoring-api
    

    Create a virtual environment to manage dependencies:

    On Linux/MacOS:

    python3 -m venv venv
    

    On Windows using CMD:

    C:\>C:\Python35\python -m venv venv
    
  3. Activate the virtual environment

    On Linux/MacOS:

    source venv/bin/activate
    

    On Windows using CMD:

    C:\> venv\Scripts\activate.bat
    
  4. Install the dependencies within the virtual environment:

    pip install -r requirements.txt
    
  5. Create a .env file within the root directory.

  6. Define the values for the environment variables, including the secret key and the database user's username and password:

    SECRET_KEY=changethis
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=password
    POSTGRES_DATABASE=database
    QUART_ENV=development
    
  7. Define the QUART_APP environment variable:

    On Linux/MacOS:

    export QUART_APP=app:app
    

    On Windows using CMD:

    set QUART_APP=app:app
    
  8. Run the app

quart run
  1. If everything was done correctly, you should see this output with no errors:
     * Serving Quart app 'src'
     * Environment: development
     * Debug mode: True
     * Running on http://127.0.0.1:5000 (CTRL + C to quit)
     development
    
  2. Go to localhost:5000 in your browser. You should see "Hello World!" Congratulations!

Contributions

All contributions are welcome, even small ones :) But please format your code by using this command before you make a pull request or contribution:

On Windows/MacOS/Linux:

black .

API Documentation

You can view documentation for this API by visiting localhost:5000/redocs or localhost:5000/docs

Roadmap

Check out the tasks on the Projects tab

About

Backend for error monitoring project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages