1.0.0 • Published 4 years ago

bluecloud-leap v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

LEAP Node.js SDK

Getting Started

You need to install LEAP and set API credentials before you get started

If you not installed yet, you can install using below options

  1. DigitalOcean One Click Installation
  2. Installing by your own

Installation

npm i @shoppre/LEAP -S

Usage

/**
 * Main application file
 */
if (!process.env.LEAP_SECRET) {
  process.env.LEAP_SECRET = 'your-secret';
}

if (!process.env.LEAP_URL) {
  process.env.LEAP_URL = 'https://login.yourdomain.com';
}

const http = require('http');
const express = require('express');

const bodyParser = require('body-parser');
const LEAP = require('@shoppre/LEAP');

const app = express();
const server = http.createServer(app);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.get('/secured', LEAP.authenticate, (req, res) => {
  return res.json(req.user);
  // - req.user show user details, only if user session is active and url is secured by LEAP
});

server.listen(8000, '0.0.0.0', (err) => {
  if (err) return console.log('Error while starting nodejs', err);
  return console.log('Server started');
});
1.0.0

4 years ago