Skip to content

Repository files navigation

User Management API

Overview

This is a simple ASP.NET Core Web API that performs CRUD operations for managing users. The API supports creating, retrieving, updating, and deleting users with validation and middleware logging.

Features

  • CRUD operations (GET, POST, PUT, DELETE)
  • Input validation using data annotations
  • Custom logging middleware
  • In-memory data storage

API Endpoints

Method Endpoint Description
GET /api/users Get all users
GET /api/users/{id} Get user by ID
POST /api/users Create new user
PUT /api/users/{id} Update user
DELETE /api/users/{id} Delete user

Sample Request (POST)

{
  "id": 3,
  "name": "Charlie",
  "email": "charlie@example.com",
  "age": 28
}

Validation Rules

  • Name must be between 2 and 100 characters
  • Email must be valid format
  • Age must be between 1 and 120

Middleware

Custom request logging middleware logs:

  • HTTP method
  • Request path
  • Response status code

How to Run

dotnet restore
dotnet run

How I Used GitHub Copilot

I used GitHub Copilot to:

  • Generate CRUD controller logic
  • Debug API route handling
  • Implement logging middleware
  • Improve validation logic

All suggestions were reviewed and refined before use.

Testing the API

Use curl:

curl http://localhost:5134/api/users

Project Outcome

This API successfully demonstrates CRUD operations, validation, and middleware integration, fulfilling the assignment requirements.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages