3.2.0 • Published 6 years ago

sassi-express-api v3.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

sassi-express-api

The sassi-express-api package is a server library convience if you happen to run express. It assumes you have the ServerBuildData (defined in sassi-core) loaded (likely from a file during the build).

You can use it like this:

const { HostedAzureAppServiceSlotData } = require('sassi-azure');
const { readBuildDataFromFile } = require('sassi-build-data');
const { registerSassiApi } = require('sassi-express-api');
const {
    SassiApiServerConfig,
    ISassiApiServerConfigOptions
} = require('sassi-server-api');

const buildDataJson = readBuildDataFromFile();
const startTimeUtc = new Date().toISOString();

const azureServiceSlot = new HostedAzureAppServiceSlotData.fromEnv(process.env);

const sassiApiConfig: ISassiApiServerConfigOptions = {
    baseUrlPath: '/api/_sassi_',
    sbdJsonPath: 'sbd.json',
    sbdHtmlPath: 'sbd.html',
    creds: {
        id:process.env.SASSI_ID,
        secret:process.env.SASSI_SECRET
    }
};

sassiApiConfig.fetchBuildData = () => buildDataJson;
sassiApiConfig.fetchServerData = () => {
    return {
        startTimeUtc,
        fetchTimeUtc: new Date().toISOString(),
        service: azureServiceSlot
    };
};

const sassiApiServerConfig = new SassiApiServerConfig(sassiApiConfig);

registerSassiApi(server, sassiApiServerConfig);

All your auth and api are taken care of...

3.2.0

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.4.3

6 years ago

2.4.2

6 years ago

2.3.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago