- .NET 7
- ASP.NET (Framework for building web apps)
- Entity Framework (ORM)
- Postgres (Database) (Server up and running required if Docker is not used)
- Docker (Containerization)
- Docker Compose (To run the database and the application)
dotnet run --urls=http://localhost:5000
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=root"
}
CREATE TABLE "Users" (
"Id" SERIAL PRIMARY KEY,
"Name" VARCHAR(50) NOT NULL,
"Email" VARCHAR(255) NOT NULL
);
POST request to http://localhost:5000/api/users
json body data format:
{
"name": "string",
"email": "string"
}
GET request to http://localhost:5000/api/users/{id}
PUT request to http://localhost:5000/api/users/{id}
json body data format:
{
"name": "string",
"email": "string"
}
DELETE request to http://localhost:5000/api/users/{id}
docker compose up -d db
(To run Postgre inside Docker container. Local Postgre server, if exist, must be stopped first)
docker exec -it db psql -U postgres
(To enter to Postgre dockerized server) Use it to create de User table in the containerized Postgre server.
docker compose build
docker compose up csharp_app