Implementation of API that will perform CRUD operations on the customer data model
RESTful API endpoints returning JSON so that a user can perform CRUD (create, read, update, delete) actions to the customers table with authentication
Update and upgrade your system to ensure that your shipped version of Python 3 is up-to-date
$ sudo apt update
$ sudo apt -y upgrade
$ python3 -V
$ sudo apt install -y python3-pip
$ sudo apt install build-essential libssl-dev libffi-dev python3-dev
$ sudo apt install -y python3-venv
$ sudo apt-get install wget ca-certificates
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib
$ sudo su - postgres
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
$ git clone https://github.com/manikandanvaidy/customers-api.git
CD (change directory) into the app root folder - customer-api
$ python3.6 -m venv env
$ source env/bin/activate
$ pip3 install -r requirements.txt
Replace the values with the appropriate values for your configuration in the following files
config.py <update database username, password, host(localhost) and database name>
run.py <update application secret key>
security.py <update username and password in users[] array for authentication>
$ python3 migrate.py db init
$ python3 migrate.py db migrate
$ python3 migrate.py db upgrade
From your terminal, make sure you are on the root folder of the app then run this command:
$ python3 run.py
Follow the guide below to use the API developed: API-Document