Skip to content

ASP.Net Core HTTP routing microservice that is lightweight, no MVC, and cross-platform, no IIS.

Notifications You must be signed in to change notification settings

soixantseize/aspnetcore-xplatform-minimal-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASP.Net Core xPlatform Minimal API

WHAT

ASP.Net Core JSON API that is lightweight, no MVC, and cross-platform, no IIS. Create, read, update, and write to your PostgreSQL database out of the box thanks to Npgsql driver and EF Core dependency injection. Includes data migration script that runs on startup and seeds initial data. Get started right away!

WHY

I loved the simplicity and portability of spinning up a RESTful app built on NodeJS and Express, only to yearn for the possibility in .NET so that I could write code in C# and leverage tools like Entity Framework, LINQ, Async Await. Hello .NET Core now makes it possible!

HOW

Disclaimer

This project borrows heavily from the following repos:

  1. RoutingSample blog post here

  2. LightweightAPI blog post here

  3. Weapsy blog post here

Prerequisites

  1. Install .NET Core (https://www.microsoft.com/net/core)
    • Successfull launches on Windows (Windows7), Mac (OSX 10.11.13), and Linux (CentOS 7.2.1511)
  2. Install PostgreSQL (https://www.postgresql.org/)
    • Successfull CRUD operations on Windows (PostgreSQL 9.4.5) and Mac (PostgreSQL 9.5.2)
  3. Update lines 22 and 23 in the file Data/ApplicationDbContext.cs with your PostgreSQL user name and password

To run application

  1. Download repository
  2. Open command prompt and navigate to repository
  3. Run command "dotnet restore"
    • Please create new issue if you are having trouble downloading dependencies
  4. Run command "dotnet run"
  5. Use Postman to send JSON GET, POST, PUT, and DELETE requests.
    • GET http://localhost:5000/blog
      {
      "Id": 1,
      "ArticleTitle": "How to Dabb",
      "ArticleContent": "First tuck you head down..."
      },
      {
      "Id": 2,
      "ArticleTitle": "How to Whip",
      "ArticleContent": "Rock back and forth..."
      },
      {
      "Id": 3,
      "ArticleTitle": "How to Nae Nae",
      "ArticleContent": "Add a connecting move..."
      },
      {
      "Id": 4,
      "ArticleTitle": "How to Dougie",
      "ArticleContent": "Pass your hand through..."
      },
      {
      "Id": 5,
      "ArticleTitle": "How to Wop",
      "ArticleContent": "Worm your upper body..."
      }

    • GET http://localhost:5000/blog/3
      {
      "Id": 3,
      "ArticleTitle": "How to Nae Nae",
      "ArticleContent": "Add a connecting move..."
      }

    • POST http://localhost:5000/blog
      {"ArticleTitle":"How to Running Man","ArticleContent":"Lift your right foot and..."}

    • PUT http://localhost:5000/blog/4
      {"ArticleTitle":"How to Moonwalk","ArticleContent":"Place one foot directly..."}

    • DELETE http://localhost:5000/blog/5

About

ASP.Net Core HTTP routing microservice that is lightweight, no MVC, and cross-platform, no IIS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages