Silicon is a C++ abstraction built on top of high-performance networking libraries. Its goal is to ease the writing of web APIs without compromising on performance. A simple mono-procedure API serving a static string under the route /hello/world. mhd_json_serve is a Silicon backend. It takes an API and serves it with the microhttpd C library. It relies on the JSON format whenever it has to encode or decode objects (procedures parameters and return values). Silicon relies on static objects (i.e. not hashmaps) to model objects. They embed static introspection in their type such that the JSON serializer knows about their members' names and types. In Silicon, parameters are strongly typed and declared next to the procession route. If any error occurs during the decoding (i.e. a missing or ill-formated parameter), the framework does not call the procedure and send an error to the client.
Features
- Procedures can take any number of middlewares in any order
- Silicon does not call the procedure and send an error to the client
- When a procedure cannot complete because of an error, it throws an exception describing the cause of the error
- The framework also provides session middlewares
- Enables an API to store information about the current user in a database, or in an in-memory hashtable
- In Silicon, parameters are strongly typed and declared next to the procedure route