MyApi is a lightweight, modular RESTful Web API built using ASP.NET Core and PostgreSQL. It features full CRUD functionality for a User entity, powered by Entity Framework Core. This project is ideal for learning how to integrate databases in .NET or for bootstrapping production-ready APIs.
GitHub: https://github.com/ralphmarondev/asp-dotnet-core-postgresql
- ✅ Full CRUD operations for
Usermodel - 🐘 PostgreSQL integration via EF Core
- 🔄 Auto migrations and schema sync
- 🧪 Easy testing with Postman or Swagger
- 🧩 Clean and extensible architecture
git clone https://github.com/ralphmarondev/asp-dotnet-core-postgresql.git
cd asp-dotnet-core-postgresqlMake sure PostgreSQL is installed and running.
CREATE DATABASE myapi;"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=myapi;Username=postgres;Password=yourpassword"
}Replace yourpassword with your actual PostgreSQL password.
Install the required packages:
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet tool install --global dotnet-efdotnet ef migrations add InitialCreate
dotnet ef database updatedotnet runThe app will be available at:
http://localhost:5220
| Method | URL | Description | Body |
|---|---|---|---|
GET |
http://localhost:5220/api/user |
Fetch all users | — |
GET |
http://localhost:5220/api/user/{id} |
Fetch user by ID | — |
POST |
http://localhost:5220/api/user |
Create a user | { "name": "Ralph Maron" } |
PUT |
http://localhost:5220/api/user/{id} |
Update user by ID | { "name": "Updated Name" } |
DELETE |
http://localhost:5220/api/user/{id} |
Delete user by ID | — |
Headers to include:
Content-Type: application/json
This project is licensed under the MIT License. See the LICENSE file for full details.
Ralph Maron Eda GitHub: @ralphmarondev
Suggestions and contributions are welcome! Feel free to fork the repo, submit issues, or open pull requests. Let’s build clean and efficient backends together. ⚙️🚀