sassi-server-api v3.2.0
sassi-server-api
Installation
yarn add sassi-server-api
Overview
Because the server API can be hosted in different frameworks (and outside of node), this package just has a few helpers that can be used by the real server to host the API. Essentially, the sassi-server-api is r provides two things:
- SassiApiServerConfig - the configuration required to host the API itself
- Helper methods for auth and HTML generation.
SassiApiServerConfig
The SassiApiServerConfig builds off the sassi-api/SassiApiConfig. It extends it with an interface that specifies two methods the server must provide:
- fetchBuildData
- fetchServerData
fetchBuildData() : IBuildData
This is a callback the server can provide the IBuildData. It can simply just load the build.json file provided by sassi-build-data and server it
fetchServerData() : IServerData
This is a callback the server can provide the IServerData. The server can provide:
* start/fetch times
* service info (azure host information, for instance)
* env information
Although the env and service info probably wont change (without restarts), the time should be generated each call.
verifyBasicAuthHeader
This just works with the client to provide basic auth (so you don't have to parse it) .
getDefaultHtml
If you want to provide an HTML version of your JSON, this is a simple default version.
Example Usage
You can see an example in the sassi-express-api