- Created a basic CRUD web application in Golang using the
net/http
module and gorm as the ORM, along with a PostgreSQL database. - Created a Dockerfile called
Dockerfile.web
for building and running the web application. This Dockerfile uses a multi-stage build to build the application and then run it. - Created a Dockerfile called
Dockerfile.db
for installing and running the PostgreSQL database on aDebian
base image, with the database data stored in a volume. The username and password for the database areb20bb005
andtoor
, respectively. - A docker-compose.yml file was created to run both the web application and the database together. The web application is exposed on port 8080, and the database is exposed on port 5432.
- The web application was tested using
curl
andPostman
to ensure that it works as expected.
GET /users
- Returns a list of all the users in the database.POST /users
- Creates a new user in the database. The request body should contain a JSON object with the following fields:name
,email
.PUT /users
- Updates the user with the specified ID. The request body should contain a JSON object with the following fields:id
,name
,email
.DELETE /users
- Deletes the user with the specified ID. The request body should contain a JSON object with the following fields:id
.
Name: Saahil Bhavsar
Roll No.: B20BB005