Skip to content

Commit

Permalink
feat: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Iam1337 authored Jun 14, 2024
1 parent f980838 commit b1dbbc0
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Created by [iam1337](https://github.com/iam1337)
- [Author Contacts](#author-contacts)

## Introduction
extApi - ...
extApi - It is a simple Http Server, which requires a minimum of specific code to work with.

### Features:

Expand Down Expand Up @@ -48,7 +48,32 @@ Or if you don't have it, add the scoped registry to manifest.json with the desir
```

## Examples
...

To make a simple Web Api, the following lines are enough:
```csharp
// Create Api Server
_api = new Api();
_api.AddController(new ApiController()); // <--- Add controller
_api.Listen(8080, IPAddress.Any, IPAddress.Loopback);

// Simple controller example
[ApiRoute("api")]
public class ApiController
{
[ApiGet("vector/{x}/{y}/{z}")] // GET /api/vector/1/2.5/5
public ApiResult GetVector(float x, float y, float z)
{
return ApiResult.Ok(new Vector3(x, y, z));
}


[ApiPost("vector")] // POST /api/vector { "x": 1.0, "y": 2.5, "z": 5.0 }
public ApiResult GetVector([ApiBody] Vector vector)
{
// TODO: ...
}
}
```

## Author Contacts
\> [telegram.me/iam1337](http://telegram.me/iam1337) <br>
Expand Down

0 comments on commit b1dbbc0

Please sign in to comment.