A REST API to manage a list of widgets registered for the wallboard.
-
.Net Core sdk 2.0
-
or Docker
The dotnet docker images are quite large (as of Feb. 2018) so you have to be patient.
cd WallboardBack
dotnet restore
dotnet run
This will serve the API at http://localhost:5000/api/
You have to set an environment variable
"ASPNETCORE_URLS=http://+:5000"
to allow the container to listen to all incoming ips.
cd WallboardBack
docker run --name wallboard-back -e "ASPNETCORE_URLS=http://+:5000" -p 5000:5000 -v ${PWD}:/app -w /app -it microsoft/dotnet
dotnet restore
dotnet run
This will serve the API at http://localhost:5000/api/
To resume a previously exited Docker container :
docker start wallboard-back
docker attach wallboard-back
dotnet restore
dotnet run
We do not support multistage build for now so you need both Docker and .Net Core SDK to build the image.
dotnet publish -c Release -o out
docker build -t wallboard_dotnetapp .
docker run --rm -p 5000:5000 wallboard_dotnetapp
This will serve the API at http://localhost:5000/api/
Scripts to create data
With Powershell
Invoke-RestMethod http://localhost:5000/api/widgets
Invoke-RestMethod http://localhost:5000/api/widgets/<guid>
Invoke-RestMethod -Uri http://localhost:5000/api/widgets -Method Post -Body '{"Name":"Google Calendar","Uri":"/google-calendar/index.html"}' -ContentType 'application/json'
Invoke-RestMethod -Uri http://localhost:5000/api/widgets -Method Post -Body '{"Name":"Twitter","Uri":"/twitter/index.html"}' -ContentType 'application/json'
Invoke-RestMethod -Uri http://localhost:5000/api/widgets/<guid> -Method Delete
With curl
curl -H "Content-Type: application/json" -X POST -d '{"Name":"Test","Uri":"/test/test"}' http://localhost:5000/api/widgets
A Swagger UI is also available