logo
0
0
WeChat Login

Cloud Native .NET Runtime

A template for developing .NET Core framework applications on Cloud Native Build (CNB) platform, implementing simple counter read/write APIs with MySQL database running in the cloud native environment.

README

Quick Start

Click the "Cloud Native Development" button to launch the online development environment with docker-compose auto-configuration! One-click setup! Let's go!

gogogo

Local Build and Debug

To build and debug locally, please refer to Microsoft .NET Documentation.

Project Structure

.
├── aspnetapp
├── docker-compose.yml
├── Dockerfile
├── .gitignore
├── README.md
└── mysql-init
    └── init.sql
└── mysql-config
    └── my.cnf
  • docker-compose.yml: Docker Compose configuration file
  • aspnetapp: Main .NET project implementing core APIs
  • Dockerfile: Container configuration
  • mysql-init/init.sql: MySQL initialization script

API Documentation

GET /api/count

Get current counter value

Parameters

None

Response

  • code: Error code
  • data: Current counter value
Example Response
{
  "code": 0,
  "data": 42
}

Example Call

curl https://<cloud-environment-domain>/api/count

POST /api/count

Update counter value (increment or reset)

Parameters

  • action: string enum
    • "inc": Increment counter by 1
    • "clear": Reset counter to 0
Example Request
{
  "action": "inc"
}

Response

  • code: Error code
  • data: Current counter value
Example Response
{
  "code": 0,
  "data": 42
}

Example Call

curl -X POST -H 'content-type: application/json' -d '{"action": "inc"}' https://<cloud-environment-domain>/api/count

License

MIT

About

云原生构建平台(CNB - Cloud Native Build)开发 .NET Core 框架模版,实现简单的计数器读写接口,使用云原生构建平台环境运行 MySQL 进行读写、记录计数值。

Language
CSS57.7%
JavaScript41.3%
Markdown0.3%
C#0.3%
Others0.4%