...
The Data Theorem API Protect NodeJS SDK is a NodeJS library that provides protection for APIs written in Javascript. The SDK integrates with your NodeJS API using the API Protect middleware which supports most popular NodeJS frameworks, including:
To Protect an API, all the API developer needs to do is add the API Protect middleware to their web application code set the client Id we provide
...
Code Block |
---|
const express = require('express');
const apiprotect = require('apiprotect');
const app = express();
// Register body parsing middlware then APIProtect middlware
app.use(express.json());
app.use(apiprotect.default()); // ClientId read from ENV: `DT_API_PROTECT_CLIENT_ID` |
...
Code Block | ||
---|---|---|
| ||
const express = require('express'); const apiprotect = require('apiprotect'); const settings = require('settings')l const app = express(); // Register body parsing middlware then APIProtect middlware app.use(express.json()); app.use(apiprotect.default(settings.clientId)); // ClientId passed as param |
...