Skip to content

frye/net-users-demo

Repository files navigation

.NET Users Demo

A .NET 9 REST API demonstration project that mirrors the functionality of the frye/go-users-demo repository. This project is designed for practicing GitHub Copilot features and Test-Driven Development with ASP.NET Core.

Project Structure

net-users-demo/
├── net-users-api/              # ASP.NET Core Web API project
│   ├── Controllers/
│   │   ├── HomeController.cs   # Handles root endpoint with HTML view
│   │   └── UsersController.cs  # REST API endpoints for user management
│   ├── Models/
│   │   └── UserProfile.cs      # User profile data model
│   ├── Views/
│   │   └── Home/
│   │       └── Index.cshtml    # HTML view displaying users in a table
│   ├── Program.cs              # Application entry point and configuration
│   ├── README.md               # Project-specific documentation
│   ├── Copilot_Practice_Instructions.md
│   └── Copilot_TDD_Practice_Instructions.md
└── net-users-demo.sln          # Solution file

Features

  • RESTful API for user profile management
  • HTML table view at root endpoint for user-friendly display
  • In-memory data storage (simple list)
  • Structured for learning - includes TODO functionality for practice
  • GitHub Copilot practice exercises included

API Endpoints

  • GET / - Display users in an HTML table
  • GET /api/v1/users - Get all users (JSON)
  • GET /api/v1/users/{id} - Get a specific user by ID
  • POST /api/v1/users - Create a new user
  • PUT /api/v1/users/{id} - Update an existing user
  • DELETE /api/v1/users/{id} - Delete a user (TODO: Not yet implemented)

Data Model

Each user profile contains:

  • id - String identifier
  • fullName - User's full name
  • emoji - An emoji representing the user

Sample users:

  • John Doe 😀
  • Jane Smith 🚀
  • Robert Johnson 🎸

Getting Started

Prerequisites

  • .NET 9.0 SDK or newer
  • Visual Studio Code (recommended) with C# Dev Kit extension
  • GitHub Copilot (for practice exercises)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd net-users-demo
  2. Restore dependencies:

    dotnet restore

Running the Application

Using the solution file:

dotnet run --project net-users-api

Or navigate to the project directory:

cd net-users-api
dotnet run

The application will start on http://localhost:8080

Testing the API

View HTML table:

open http://localhost:8080

Get all users (JSON):

curl http://localhost:8080/api/v1/users

Get a specific user:

curl http://localhost:8080/api/v1/users/1

Create a new user:

curl -X POST http://localhost:8080/api/v1/users \
  -H "Content-Type: application/json" \
  -d '{"id":"4", "fullName":"Alice Cooper", "emoji":"🎭"}'

Update a user:

curl -X PUT http://localhost:8080/api/v1/users/1 \
  -H "Content-Type: application/json" \
  -d '{"id":"1", "fullName":"John Smith", "emoji":"😎"}'

Delete a user (not yet implemented):

curl -X DELETE http://localhost:8080/api/v1/users/1

Practice Exercises

This project includes comprehensive practice materials for learning GitHub Copilot:

Getting Started (Beginner)

  1. Copilot_Practice_Instructions.md - Learn GitHub Copilot basics:

    • Inline code completion
    • Ask/Edit mode
    • Copilot CLI
    • Agent mode
  2. Copilot_TDD_Practice_Instructions.md - Practice Test-Driven Development:

    • Using Testing custom chat mode
    • Using TDD custom chat mode
    • Red-Green-Refactor cycle
    • Test coverage analysis

Advanced Practice (Intermediate to Advanced)

  1. Advanced Practice Instructions - Comprehensive advanced exercises:
    • 📝 10 Modules covering real-world scenarios
    • 🌱 GitHub Spec-Kit introduction for structured development
    • 🎓 Capstone Projects for advanced challenges
    • 💡 Best Practices and professional patterns

Topics Include:

  • CRUD operations & API design enhancements
  • Input validation & error handling
  • Comprehensive testing strategies (unit, integration, property-based)
  • Repository pattern & database migrations
  • Configuration management & secrets
  • Authentication & authorization (API keys, JWT)
  • Observability (logging, metrics, tracing)
  • Documentation & developer experience
  • CI/CD pipelines & automation
  • Architecture & scalability patterns

👉 Start with the Advanced Practice Guide →

Comparison with Go Demo

This .NET implementation mirrors the frye/go-users-demo project:

Feature Go Demo .NET Demo
Framework Gin ASP.NET Core
Language Go C#
View Engine Go templates Razor
Port 8080 8080
Data Storage In-memory slice In-memory List
DeleteUser TODO TODO
Sample Users 3 users 3 users (same)

Development

Building the project:

dotnet build

Running tests (after generating them):

dotnet test

Cleaning build artifacts:

dotnet clean

License

This project is for educational purposes.

Contributing

This is a demonstration project for learning GitHub Copilot and TDD practices. Feel free to use it as a template for your own learning.

About

A .Net REST API for user profiles. Includes user id, full name, and emoji.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published