Skip to content

hilderbrandtjohn/BOOKSHELF-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

BOOKSHELF API


Get information about books via a RESTful API


Pre-requisites

  • Have Python3, pip installed on your local machines.

  • Start your virtual environment From the parent folder run

# Mac users
python3 -m venv venv
source venv/bin/activate
# Windows users
> py -3 -m venv venv
> venv\Scripts\activate
  • Install dependencies
    From the parent folder run
# All required packages are included in the requirements file. 
pip3 install -r requirements.txt
# In addition, you will need to UNINSTALL the following:
pip3 uninstall flask-socketio -y

Step 1 - Create and Populate the database

  1. **Create the database In your terminal, navigate to the parent directory, and run the following:
# Connect to the PostgreSQL
psql postgres
#View all databases
\l
# Create the database
\i setup.sql
# Exit the PostgreSQL prompt
\q
  1. Create tables
    Once your database is created, you can create tables (bookshelf) and apply contraints
# Mac users
psql -f books.psql -U student -d bookshelf
# Linux users
su - postgres bash -c "psql bookshelf < /path/to/exercise/backend/books.psql"

You can even drop the database and repopulate it, if needed, using the commands above.

Step 2: Start the server

Start the Flask server by running the command below from the parent directory.

export FLASK_APP=flaskr
export FLASK_ENV=development
flask run

Running Tests

Navigate to the parent folder and run:

python test_flaskr.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages