Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softchris/mock-sharp
Mock API for minimal API, ASP .NET, written in C#
https://github.com/softchris/mock-sharp
Last synced: 4 days ago
JSON representation
Mock API for minimal API, ASP .NET, written in C#
- Host: GitHub
- URL: https://github.com/softchris/mock-sharp
- Owner: softchris
- Created: 2022-02-21T23:03:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-22T13:09:07.000Z (over 2 years ago)
- Last Synced: 2024-11-02T10:24:48.567Z (11 days ago)
- Language: C#
- Size: 6.84 KB
- Stars: 11
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mock-sharp
Mock API for minimal API, ASP .NET, written in C#
## Run
Type `dotnet run`
```bash
dotnet run
```This should show the supported routes in the terminal
## NuGet package
Coming...
## Features
Given a mock file, (for now it's hardcoded as *mock.json*), with the following JSON content:
```json
{
"Products": [
{
"Id": 1,
"Name": "Mock"
},
{
"Id": 2,
"Name": "Second Mock"
}
]
}
```it will create the below routes:
|Verb |Route | Description |
|---------|---------|---------|
|GET | /products | fetches a list of products |
|GET | /products/{id} | fetches one product, given unique identifier `id` |
|POST | /products | creates a new product, assumes a JSON represenation is sent via the BODY |
|DELETE | /products/{id} | deletes one product, given unique identifier `id` |
|PUT | | Coming.. |### Query parameters
Coming
## Mock data
mock data is in *mock.json*. Here's an example of what it could look like:
```json
{
"Products": [
{
"Id": 1,
"Name": "Mock"
},
{
"Id": 2,
"Name": "Second Mock"
}
],
"Orders": [
{
"Id": 1,
"Name": "Order1"
},
{
"Id": 2,
"Name": "Second Order"
}
]
}
```