Package Exports
- @sheetbase/api-key-server
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sheetbase/api-key-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sheetbase Module: @sheetbase/api-key-server
Sheetbase middleware to authorize with the API Key.
Install
Using npm: npm install --save @sheetbase/api-key-server
import * as ApiKey from "@sheetbase/api-key-server";As a library: 1NulS_tPHLm401X7Km_ONKgtRK-VHnC5ODmNZ1sMt0QgXuDgtffxJ-Zzv
Set the Indentifier to ApiKeyModule and select the lastest version, view code.
declare const ApiKeyModule: { ApiKey: any };
const ApiKey = ApiKeyModule.ApiKey;Usage
Docs homepage: https://sheetbase.github.io/api-key-server
API reference: https://sheetbase.github.io/api-key-server/api
Examples
import * as Sheetbase from "@sheetbase/core-server";
import * as ApiKey from "./public_api";
const key = "my_api_key";
function load_() {
return Sheetbase.sheetbase();
}
export function example1(): void {
const Sheetbase = load_();
Sheetbase.Router.get("/auth", ApiKey.middleware({ key }), (req, res) => {
res.send("I have it!");
});
Logger.log("[Not executable] Per route middleware.");
}
export function example2(): void {
const Sheetbase = load_();
Sheetbase.Router.use(ApiKey.middleware({ key }));
Sheetbase.Router.get("/auth", (req, res) => {
res.send("I have it!");
});
Sheetbase.Router.post("/auth", (req, res) => {
res.send("I have it!");
});
Logger.log("[Not executable] Global use middleware.");
}License
@sheetbase/api-key-server is released under the MIT license.