
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/extapi.git#upm README Markdown
Copy this to your project's README.md
## Installation
Add **extApi** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/extapi.git#upm
```
[](https://www.pkglnk.dev/pkg/extapi)README
extApi - Simple Http Server for Unity
Created by iam1337
Table of Contents
Introduction
extApi - It is a simple Http Server, which requires a minimum of specific code to work with.
Features:
Installation
Old school
Just copy the Assets/extApi folder into your Assets directory within your Unity project.
OpenUPM
Via openupm-cli:
openupm add com.iam1337.extapi
Or if you don't have it, add the scoped registry to manifest.json with the desired dependency semantic version:
"scopedRegistries": [
{
"name": "package.openupm.com",
"url": "https://package.openupm.com",
"scopes": [
"com.iam1337.extapi",
]
}
],
"dependencies": {
"com.iam1337.extapi": "1.0.0"
}
Examples
To make a simple Web Api, the following lines are enough:
// 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
> ext@iron-wall.org
License
This project is under the MIT License.
No comments yet. Be the first!