lms-api

command module
v0.0.0-...-32e9a0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 20 Imported by: 0

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.

  1. Create private key.
openssl ecparam -genkey -name prime256v1 -noout -out ./keys/ecdsa_private_key.pem
  1. 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": "example@example.com",
  "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": "example@example.com",
  "Password": "securepassword123"
}' && echo ""

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL