modulepackage
0.0.0-20250121192252-32e9a0ac60d0
Repository: https://github.com/kunnoh/lms-api.git
Documentation: pkg.go.dev
# README
Library Management System
Clone lms-api
repository.
git clone https://github.com/kunnoh/lms-api.git
Go to directory. And run ./run.sh help
to see available options.
cd lms-api
./run.sh
Configuration
Change example.env
to .env
at the root folder of project.
Set the information in .env
.
Export variables to environment from .env
file to the current terminal session.
./env.sh
JWT key generation
Genarate ECDSA keys used to generate jwt
token. Save them in ./keys
folder.
- Create private key.
openssl ecparam -genkey -name prime256v1 -noout -out ./keys/ecdsa_private_key.pem
- Generate public key
openssl ec -in ./keys/ecdsa_private_key.pem -pubout -out ./keys/ecdsa_public_key.pem
NOTE:
Make sure you have postgres database running.
Run postgres
container using docker
:
./run.sh start-db
Start app Run the app for development.
./run.sh dev
Run tests
./run.sh test
Build
Build executable Build app.
./run.sh build-app
Build docker image
./run.sh build-image
API testing
Register.
curl -X POST http://localhost:7755/auth/register \
-H "Content-Type: application/json" \
-d '{
"Email": "[email protected]",
"Name": "John Doe",
"Password": "securepassword123",
"Phone": "+1234567890",
"IdNumber": "912345678"
}' && echo ""
Login.
curl -X POST http://localhost:7755/auth/login \
-H "Content-Type: application/json" \
-d '{
"Email": "[email protected]",
"Password": "securepassword123"
}' && echo ""