This sample application is an in-memory capabilities-based data store. It is a CRUD RESTful web API built using Suave.
PUT /api/create
. The body of the request is placed in the data store, and the API returns a GUID that can be used to read, update, delete, or delegate access to the data.GET /api/read/{guid}
. If the supplied GUID has read access to some data, that data is returned.GET /api/delegate/{access}/{guid}
. Access must be a string that contains some combination ofr
(read),u
(update), andd
(delete). If the access requested is the same or a subset of the access on the supplied GUID, a new GUID is returned that has the requested access rights on the supplied GUID.POST /api/update/{guid}
. If the supplied GUID has update access to some data, that data is changed to be the body of the request.DELETE /api/delete/{guid}
. The GUID supplied is deleted. If the supplied GUID has delete access to some data, the entire chain of GUIDs back to the source is deleted.
The following build files can be used as a template for any F# Azure App Service:
build.fsx
. This contains the logic for testing and building your application using FAKE.build.sh
andbuild.cmd
. These scripts handle package management with Paket and invoke FAKE. They do the same thing: the.sh
is for Linux and OSX, and the.cmd
is for Windows..deployment
. This tells Azure App Service how to test and build your application. It invokes the build script.
Testing is done with FsCheck, a property-based testing library derived from QuickCheck. It lets you specify properties about your program, and FsCheck will generate many inputs, attempting to falsify those properties if possible. If FsCheck can falsify a property, it will also give you a reduced test case that causes the problem that you can use for debugging.
Suave has many useful features for web programming: