Skip to content

feat: add sample app for http postgres#209

Merged
AkashKumar7902 merged 2 commits intomainfrom
http-postgres
Mar 13, 2026
Merged

feat: add sample app for http postgres#209
AkashKumar7902 merged 2 commits intomainfrom
http-postgres

Conversation

@AkashKumar7902
Copy link
Contributor

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:

  • Added handler/handler.go with endpoints for creating, listing, and retrieving companies, including error handling for duplicates and invalid input.
  • Added handler/projects.go with endpoints for creating, listing, retrieving, and updating projects, using UUIDs for project IDs and handling value substitution for testing.
  • Introduced main.go to wire up the database connection, run migrations, and register HTTP routes for both companies and projects.

Database Setup:

  • Added db/db.go for database connection logic, environment variable handling, and migration functions to create companies and projects tables with the necessary constraints and extensions.
  • Added go.mod to declare dependencies (pq for PostgreSQL, uuid for project IDs).

Containerization and Local Development:

  • Added Dockerfile to build and run the Go server in an Alpine-based container.
  • Added docker-compose.yml to orchestrate the API and PostgreSQL containers, including health checks and environment setup.
  • Updated .gitignore to exclude the keploy directory.

Testing Scripts:

  • Added test.sh for rapid-fire parallel and sequential testing of the companies API, including duplicate and error cases.
  • Added test_projects.sh for sequential testing of the projects API, covering creation, retrieval, update, and listing, with handling for UUID substitution.

Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Copilot AI review requested due to automatic review settings March 11, 2026 13:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Member

@khareyash05 khareyash05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkashKumar7902 AkashKumar7902 merged commit 2cb90fe into main Mar 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants