Skip to content

Dhar01/medicine-app

Repository files navigation

medicine-app

A medicine e-commerce backend in Go.

SetUp

This project uses Go and PostgresSQL. Please ensure to set them up before proceeding.

  1. Install Go

    go version
  2. Install PostgreSQL

    psql --version

Environment Variables

Create a .env file in the root directory with the following variables:

DB_URL="postgres://<username>:<password>@<host>:<port>/<database_name>"
SECRET_KEY="Your Secret Key here"
PLATFORM="<environment>"
  • Replace the DB_URL values with your database connection string.
  • Currently available platform is "deb".

Find db_migration.sh in the scripts to automate DB migration.

To-Do

  • Explore more security options (mostly encryption on cookies and tokens).
  • Build cmd or use config file for the variable setup in constants.go.

API-endpoints

Medicine

name method route note
create medicine POST /api/v1/medicines admin only
get all medicine GET /api/v1/medicines
get medicine by ID GET /api/v1/medicines/:medID
update medicine by ID PUT /api/v1/medicines/:medID admin only
delete medicine by ID DELETE /api/v1/medicines/:medID admin only

Users

name method route note
get user by ID GET /api/v1/users/:userID admin only
signup user POST /api/v1/signup
login user POST /api/v1/login
verify user GET /api/v1/verify?token=token auto-generated
update user PUT /api/v1/users
logout user POST /api/v1/logout
delete user DELETE /api/v1/users
refresh token POST /api/v1/refresh
revoke token POST /api/v1/revoke

General

name method route note
reset DB POST /api/v1/reset dev environment only

Status

code coverage badge

About

Medicine e-commerce backend in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published