The Go Dhammapada API is a RESTful service that provides access to the verses of the Dhammapada, a collection of sayings of the Buddha in verse form. This API allows users to retrieve verses, search for specific terms, and get information about the chapters.
To install and run the project locally, follow these steps:
- Clone the repository:
git clone https://github.com/hendrasan/go-dhammapada-api.git
- Navigate to the project directory:
cd go-dhammapada-api
- Install dependencies:
go mod tidy
- Copy .env.example to .env then update .env with your db (postgresql) credentials
cp .env.example .env
- Run the application:
go run cmd/api/main.go
Once the application is running, you can access the API at http://localhost:8080
. Use a tool like curl
or Postman to interact with the endpoints.
Here are some of the available endpoints:
-
GET /health
: Health check -
GET /api/v1/chapters
: Retrieve all chapters. -
GET /api/v1/chapters/{id}
: Retrieve a specific chapter by ID. -
GET /api/v1/verses
: Retrieve all verses. -
GET /api/v1/verses/{id}
: Retrieve a specific verse by ID. -
GET /api/v1/verses/random
: Retrieve a random verse. -
GET /api/v1/search?q={term}
: Search for verses containing a specific term.