Installation

  npm install djaty-nodejs

Import and initiate djaty-nodejs

Import djaty-nodejs module at the top of the code entry file, i.e, app.js then initiate it.

const {djaty} = require('djaty-nodejs');
djaty.init({
  apiKey: 'YOUR_PROJECT_API_KEY_HERE',
  apiSecret: 'YOUR_PROJECT_API_SECRET_HERE',
});

Just configure the apiKey and the apiSecret and Djaty will be ready!

Express

If the application uses Express, just configure Djaty Request and Error middleware. Noting that Djaty request middleware should be the first middleware used and Djaty request middleware should be the last middleware used

const app = express();

// First middleware to be used should be `djaty.requestHandler()`
app.use(djaty.requestHandler());

// ... Using all other application middleware

// Last middleware to be used should be `djaty.errorHandler()`
app.use(djaty.errorHandler());