A REST/JSON API for database operations
- Database functions
A simple server that creates a REST-like API for querying and modifying data in the database. When making a request to the server, it parses the URL to get the API version and resource path, then makes a query to the endpoint.request function in the database.
The entry point is a request function that the uWSGI server uses to pass on th HTTP verb, API version, and resource path.
How Aquameta processes a request
Every request is first processed by the uWSGI server. The uWSGI server connects to PostgreSQL initially as the
anonymoususer, which has a limited set of permissions for authenticating and not much else. If the user has a session cookie set, that cookie is checked to be valid and if it is, they can keep being that user. If not, there is no cookie so they are anonymous.
Once authentication is handled, the request is routed to the appropriate handler based on the requested path. If the request begins with the base endpoint URL (usually
/endpoint), it is handled as a REST request. Otherwise, it is handled by the uWSGI server.