Deploy ASP.NET Minimal API
A simple hello-world application made in C# with minimal API
ASP.NET-Minimal-API
ThallesP/ASP.NET-Minimal-API
Just deployed
Hello World Minimal API
A simple .NET Minimal API project that demonstrates a basic web API setup with multiple endpoints.
Description
This project is a minimal .NET web API that provides different ways to get a "Hello World" response. It's built using the .NET Minimal API approach, which provides a lightweight way to create HTTP APIs with minimal code.
Prerequisites
Getting Started
Running the Application
-
Clone the repository:
git clone https://github.com/yourusername/HelloWorldMinimalApiRailway.git cd HelloWorldMinimalApiRailway -
Run the application:
dotnet run -
The API will be available at:
http://localhost:5000
Running with Docker
-
Build the Docker image:
docker build -t minimalapi . -
Run the container:
docker run -p 5000:5000 minimalapi -
Access the API at:
http://localhost:5000
API Endpoints
GET /: Returns "Hello World!" as plain textGET /json: Returns a JSON response{ "message": "Hello World!" }GET /json/{name}: Returns a personalized JSON response{ "message": "Hello {name}!" }
Example Responses
-
Plain text response:
Hello World! -
JSON response:
{ "message": "Hello World!" } -
Personalized JSON response:
{ "message": "Hello John!" }
Project Structure
Program.cs: Contains the main application code and API endpoint definitionsDockerfile: Contains the Docker configuration for containerized deploymentappsettings.json: Contains application configuration settingsappsettings.Development.json: Contains development-specific settings
Deployment
This project is configured for deployment on Railway. The necessary configuration files are included in the repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Template Content
ASP.NET-Minimal-API
ThallesP/ASP.NET-Minimal-API