Code Monkey home page Code Monkey logo

todoapp-fastapi's Introduction

toDoApp-fastAPI

This API is written with FastAPI and Python for a ToDo app.

Prerequisites

Before to start, please note this app is built with Python 3.11 in mind. Please mind that using previous version might create issues on your development experience.

Install the virtual environment

If it is the first time you start the application on your machine, remember to set up a virtual machine:

# For Windows users
python3.exe -m venv .venv

# From Mac/Linux users
python3 -m venv .venv

Then activate with the following command to enter the environment:

# For Windows users
.venv\Scripts\activate

# From Mac/Linux users
source venv/bin/activate

Then install dependencies:

pip install -r requirements.txt

Environment variables

Environment variables included in the .env file will be used inside the application. This file is excluded from source control, so you want to create it in the root folder (at the same level as main.py), with the same structure as default.env.

You can also locally use a local.env file, as an alternative to .env. It is also excluded from git.

The list of necessary environment variables is the following:

  • DEBUG: whether FastAPI should start in debug mode or not
    • default: false
  • LOG_LEVEL: from which level log will be printed out
    • default: INFO
    • possible values: NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL
  • MONGO_URL (mandatory): the path of the Mongo database to connect with, containing host and port;
  • DATABASE_NAME (mandatory): the name of the MongoDB database;
  • HASH_KEY (mandatory): this is a 32 letter hash that will be used to hash passwords (e.g. via Linux, you can generate it typing openssl rand -hex 32 on a terminal)

How to run

You can start the application with the following:

uvicorn main:app --reload

It will be exposed at http://localhost:8000

How to test

Every test should be included in the tests folder. We use Pytest to run tests. Simply launch:

pytest

to let the magic happen.

todoapp-fastapi's People

Contributors

thisisdemetrio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.