Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cristipufu/json-server-net
Dynamic JSON Server API built with ASP.NET Core Minimal APIs
https://github.com/cristipufu/json-server-net
aspnetcore crud-api fake-server json-database json-server minimal-api minimal-apis mocks-server net8
Last synced: about 2 months ago
JSON representation
Dynamic JSON Server API built with ASP.NET Core Minimal APIs
- Host: GitHub
- URL: https://github.com/cristipufu/json-server-net
- Owner: cristipufu
- License: mit
- Created: 2024-04-13T05:42:28.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-04-13T06:01:32.000Z (9 months ago)
- Last Synced: 2024-10-12T18:23:54.737Z (3 months ago)
- Topics: aspnetcore, crud-api, fake-server, json-database, json-server, minimal-api, minimal-apis, mocks-server, net8
- Language: C#
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JSON Server Minimal APIs
This repository contains the source code for a dynamic JSON Server API built with ASP.NET Core Minimal APIs. The API provides RESTful services to interact with data stored in a JSON file, allowing CRUD operations on dynamically defined tables.## Getting Started
### clone
```bash
cd json-server-api\src\JsonServer
```
### seedPaste the contents of your database in the `db.json` file:
```json
{
"posts": [
{ "id": "1", "title": "a title", "views": 100 },
{ "id": "2", "title": "another title", "views": 200 }
],
"comments": [
{ "id": "1", "text": "a comment about post 1", "postId": "1" },
{ "id": "2", "text": "another comment about post 1", "postId": "1" }
]
}
```
### run```bash
dotnet run
```
### browseNavigate to `http://localhost:5023/swagger/index.html` to view and interact with the API documentation.
## API Endpoints
Each table in the JSON database can be accessed via its name through the following endpoints:- `GET /{tableName}`: retrieves all entries from the specified table.
- `GET /{tableName}/{id}`: retrieves a single entry by Id from the specified table.
- `POST /{tableName}`: creates a new entry in the specified table.
- `PUT /{tableName}/{id}`: updates an existing entry by Id in the specified table.
- `DELETE /{tableName}/{id}`: deletes an entry by Id from the specified table.# Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.# License
This project is licensed under the MIT License.# Support
If you encounter any issues or have questions, please file an issue on this repository.