feat: add sample app for http postgres#209
Merged
AkashKumar7902 merged 2 commits intomainfrom Mar 13, 2026
Merged
Conversation
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a sample Go HTTP API backed by PostgreSQL, including local container orchestration and shell scripts to exercise the endpoints.
Changes:
- Introduces Go server wiring (
main.go), DB connection/migrations, and CRUD-style HTTP handlers for companies and projects. - Adds Dockerfile + docker-compose setup for running the API with Postgres locally.
- Adds shell scripts to test companies/projects endpoints.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| http-postgres/main.go | Wires DB connection/migrations and registers HTTP routes. |
| http-postgres/db/db.go | Adds Postgres connect + schema migration for companies/projects. |
| http-postgres/handler/handler.go | Implements companies endpoints and JSON helpers. |
| http-postgres/handler/projects.go | Implements projects endpoints (UUID IDs) and listing/updating. |
| http-postgres/docker-compose.yml | Adds local orchestration for API + Postgres with healthcheck. |
| http-postgres/Dockerfile | Builds and packages the Go API into a small runtime image. |
| http-postgres/go.mod | Declares module, Go version, and dependencies. |
| http-postgres/go.sum | Adds dependency checksums. |
| http-postgres/test.sh | Adds a parallel/sequential companies API smoke test script. |
| http-postgres/test_projects.sh | Adds a projects API smoke test script with UUID capture. |
| http-postgres/.gitignore | Ignores keploy directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new Go-based HTTP API server for managing companies and projects with a PostgreSQL backend. It includes database setup and migration, handler implementations for CRUD operations, Docker and Compose configurations for local development, and scripts for testing the endpoints. The most important changes are grouped below.
API Implementation:
handler/handler.gowith endpoints for creating, listing, and retrieving companies, including error handling for duplicates and invalid input.handler/projects.gowith endpoints for creating, listing, retrieving, and updating projects, using UUIDs for project IDs and handling value substitution for testing.main.goto wire up the database connection, run migrations, and register HTTP routes for both companies and projects.Database Setup:
db/db.gofor database connection logic, environment variable handling, and migration functions to createcompaniesandprojectstables with the necessary constraints and extensions.go.modto declare dependencies (pqfor PostgreSQL,uuidfor project IDs).Containerization and Local Development:
Dockerfileto build and run the Go server in an Alpine-based container.docker-compose.ymlto orchestrate the API and PostgreSQL containers, including health checks and environment setup..gitignoreto exclude thekeploydirectory.Testing Scripts:
test.shfor rapid-fire parallel and sequential testing of the companies API, including duplicate and error cases.test_projects.shfor sequential testing of the projects API, covering creation, retrieval, update, and listing, with handling for UUID substitution.