Giter Site home page Giter Site logo

hngx-person-crud-api's Introduction

Person CRUD REST API

A simple REST API for performing CRUD operations on person records using Flask-smorest and SQLAlchemy.

Table of Contents

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.7 or higher installed.
  • virtualenv installed (optional but recommended for isolating project dependencies).
  • Git installed.
  • Access to a PostgreSQL, MySQL, or SQLite database (SQLite is used by default).

Installation and Configuration

  1. Clone this repository:

    git clone https://github.com/your-username/person-crud-api.git
    cd person-crud-api
    
    
  2. Create and activate a virtual environment:

    python -m venv venv
    

    For macOS / Linux:

    source venv/bin/activate
    

    For Windows:

    venv\Scripts\activate
    
  3. Install project dependencies:

    pip install -r requirements.txt
    
  4. Create a .flaskenv file in the root directory for basic environmental variables:

    DATABASE_URL=sqlite:///data.db  # Use your database URL (e.g., PostgreSQL or MySQL)
    FLASK_ENV=development
    FLASK_APP=app.py
    

P.S.: Not recommended for production.

Database Setup

Create the initial database tables: flask db init flask db migrate -m "Initial migration" flask db upgrade

Running The Application

Start the development server using the command: flask run

The API will be running locally at http://localhost:5000.

Testing

Testing Prerequisites

Before running the tests, ensure you have the following dependencies installed:

  • pytest (You can install this using pip install pytest) or
  • unittest (You can install this using pip install unittest)

Running Tests

You can run the tests for this project using the following command:

pytest

or

python3 -m unittest -v

hngx-person-crud-api's People

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.