This is a simple blog API built with Go and Fiber. It allows you to create, read, update, and delete blogs.
Before running the application, make sure you have the following tools installed:
- Go 1.x or higher
- PostgreSQL
- golang-migrate for database migrations:
go install github.com/golang-migrate/migrate/v4/cmd/migrate@latest
- sqlc for type-safe SQL:
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
- jq for JSON processing:
- Ubuntu/Debian:
sudo apt-get install jq - Mac:
brew install jq - Windows:
choco install jq
- Ubuntu/Debian:
Create a config.json file by copying the sample configuration:
cp sample.config.json config.json# Run database migrations
make migrate-up
# Generate type-safe database code
make sqlc# Install dependencies
go mod tidy
# Start the server
make servermake server- Run the applicationmake migrate-up- Apply database migrationsmake migrate-down- Rollback database migrationsmake sqlc- Generate database code