ybkuroki / aspnetcore-webapp-sample

ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aspnetcore-webapp-sample

Preface

This sample project uses ASP.NET Core and Entity Framework Core. It provides only Web API. So, I recommend using a vuejs-webapp-sample project as Web Front End.

Install

Perform the following steps:

  1. Download and install .NET Core SDK.
  2. Download and install Visual Studio Code(VS Code).
  3. Install C# for Visual Studio Code (powered by OmniSharp) extension for VS Code.
  4. Clone this repository.
  5. Opening the project folder will download dependencies.

Starting Server

Perform the following steps:

  1. Open this sample project.
  2. Select Debug > Start Debugging in menu bar.
  3. When startup is complete, the console shows the following message:
    Hosting environment: Development
    Content root path: [Project Path]
    Now listening on: http://[::]:8080
    Application started. Press Ctrl+C to shut down.
    
  4. Access http://localhost:8080/api/health in your browser and confirm that this application has started.
  5. Log in with the following username and password.
    • username : test
    • password : Pa$$w0rd

Creating a Production Build

Perform the following command:

$ dotnet publish -c Release -o out

Project Map

The follwing figure is the map of this sample project.

- aspnetcore-webapp-sample
  + Common                  … Provide a common service of this system.
  + Controllers             … Define controllers.
  + Models                  … Define models.
  + Repositories            … Provide a service of database access.
  + Services                … Provide a service of book management.
  + Logger                  … Provides logging using Log4Net
  - Startup.cs              … Define configurations such as database connections, security, and swagger.
  - Program.cs              … Entry Point.
  - log4net.config          … The configuration file for Log4Net

Services

This sample provides 3 services: book management, account management, and master management. Web APIs of this sample can be confirmed from Swagger.

Book Management

There are the following services in the book management.

Service Name HTTP Method URL Parameter Summary
List Service GET /api/book/list Page Get a list of books.
Regist Service POST /api/book/new Book Regist a book data.
Edit Service POST /api/book/edit Book Edit a book data.
Delete Service POST /api/book/delete Book Delete a book data.
Search Title Service GET /api/book/search Keyword, Page Search a title with the specified keyword.
Report Service(No implementation) GET /api/book/allListPdfReport Nothing Output a list of books to the PDF file.

Account Management

There are the following services in the Account management.

Service Name HTTP Method URL Parameter Summary
Login Service POST /api/account/login Session ID, User Name, Password Session authentication with username and password.
Logout Service POST /api/account/logout Session ID Logout a user.
Login Status Check Service GET /api/account/loginStatus Session ID Check if the user is logged in.
Login Username Service GET /api/account/loginAccount Session ID Get the login user's username.

Master Management

There are the following services in the Master management.

Service Name HTTP Method URL Parameter Summary
Category List Service GET /api/master/category Nothing Get a list of categories.
Format List Service GET /api/master/format Nothing Get a list of formats.

Libraries

This sample uses the following libraries.

Library Name Version
ASP.NET Core 3.1
Entity Framework Core 3.1
System.Linq 4.3.0
Newtonsoft.Json 12.0.3
log4net 2.0.8
Swashbuckle.AspNetCore 5.0.0-rc5

License

The License of this sample is MIT License.

About

ASP.NET Core

License:MIT License


Languages

Language:C# 100.0%