Proof of concept that we can add new Web APIs to an ASP.NET Web API project while it is running and without restarting it.
In the following steps, {host} is the base URL of your host environment. For me, it is an IIS Express: "localhost:49603".
curl -X POST -H "Content-Type: application/json" "http://{host}/api/modules/"
We have not added any module yet. So you should receive an empty array: [ ].
curl -X GET -H "Content-Type: application/json" "http://localhost:49603/api/articles"
The "articles" module has been not added yet. So you should receive a 404 (Not Found) status.
curl -X POST -H "Content-Type: application/json" "http://localhost:49603/api/modules/moduleone"
The application tries to locate ModuleOne.dll
in the ~/plugins
folder and load it to the Application Domain
.
You should receive a 204 (No content) status.
curl -X POST -H "Content-Type: application/json" "http://{host}/api/modules/"
This time, you will receive something like:
[
"ModuleOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
]
curl -X GET -H "Content-Type: application/json" "http://localhost:49603/api/articles"
This time, you will receive a 200 (OK) status with the following body:
[
{
"Id": 101
},
{
"Id": 102
}
]