# ltijs-postgresql

> Plugin for ltijs to use postgresql instead of mongodb

Latest version **1.2.0** (published 2019-12-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ltijs-postgresql
pnpm add ltijs-postgresql
yarn add ltijs-postgresql
bun add ltijs-postgresql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-12-17 |
| First published | 2019-09-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.6.0 |
| Dependencies | 3 |
| Unpacked size | 27.8 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | cvmcosta |
| Maintainers | cvmcosta |
| Keywords | ltijs, lti, postgresql, postgres, provider, ims |

## Links

- npm: https://www.npmjs.com/package/ltijs-postgresql
- Repository: https://github.com/Cvmcosta/ltijs-postgres
- Homepage: https://github.com/Cvmcosta/ltijs-postgres#readme
- Issues: https://github.com/Cvmcosta/ltijs-postgres/issues
- npm.io page: https://npm.io/package/ltijs-postgresql

## Dependencies (3)

- [pg](https://npm.io/package/pg.md) ^7.12.1
- [sequelize](https://npm.io/package/sequelize.md) ^5.16.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.5.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-12-17
- 1.0.0 — 2019-09-02

## README

<div align="center">
	<br>
	<br>
	<a href="https://cvmcosta.github.io/ltijs"><img width="360" src="https://raw.githubusercontent.com/Cvmcosta/ltijs/987de79b9a3d529b1b507baa7b7a95d32ab386c2/docs/logo-300.svg?sanitize=true"></img></a>
</div>



> LTIJS postgreSQL plugin.

[![travisci](https://img.shields.io/travis/cvmcosta/ltijs.svg)](https://travis-ci.org/Cvmcosta/ltijs)
[![codecov](https://codecov.io/gh/Cvmcosta/ltijs/branch/master/graph/badge.svg)](https://codecov.io/gh/Cvmcosta/ltijs)
[![Node Version](https://img.shields.io/node/v/ltijs.svg)](https://www.npmjs.com/package/ltijs)
[![NPM package](https://img.shields.io/npm/v/ltijs.svg)](https://www.npmjs.com/package/ltijs)
[![NPM downloads](https://img.shields.io/npm/dm/ltijs)](https://www.npmjs.com/package/ltijs)
[![dependencies Status](https://david-dm.org/cvmcosta/ltijs/status.svg)](https://david-dm.org/cvmcosta/ltijs)
[![devDependencies Status](https://david-dm.org/cvmcosta/ltijs/dev-status.svg)](https://david-dm.org/cvmcosta/ltijs?type=dev)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![APACHE2 License](https://img.shields.io/github/license/cvmcosta/ltijs)](#license)
[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffe-blue)](https://www.buymeacoffee.com/UL5fBsi)




## Table of Contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)


---
## Introduction

This package allows [LTIJS](https://cvmcosta.github.io/ltijs) to work with the postgreSQL database. 


---


## Installation

```shell
$ npm install ltijs-postgres
```

---

## Usage


> Install PostgreSQL

 - [Installing PostgreSQL](https://www.postgresql.org/)


> Instantiate and use plugin



```javascript

// Require Provider 
const LTI = require('ltijs').Provider
const Database = require('ltijs-postgres')

// Instantiate and configure plugin
const db = new Database({
  database: 'databaseName', // Database name. Ex: lti_database
  user: 'databaseUser', // Database username. Ex: user
  pass: 'databasePass', // Database password. Ex: password 
  host: 'databaseHost' // Database host. Ex: localhost
})

// Configure provider and the Database
const lti = new LTI('EXAMPLEKEY', 
            { plugin: db }, // You set the plugin option as the instance of the Postgres Database Class 
            { appUrl: '/', loginUrl: '/login', logger: true })


let setup = async () => {
  // Deploy and open connection to the database
  await lti.deploy()

  // Register platform
  let plat = await lti.registerPlatform({ 
    url: 'https://platform.url',
    name: 'Platform Name',
    clientId: 'TOOLCLIENTID',
    authenticationEndpoint: 'https://platform.url/auth',
    accesstokenEndpoint: 'https://platform.url/token',
    authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset' }
})

  // Set connection callback
  lti.onConnect((connection, request, response) => {
    // Call redirect function
    lti.redirect(response, '/main')
  })

  // Set main route
  lti.app.get('/main', (req, res) => {
    // Id token
    console.log(res.locals.token)
    res.send('It\'s alive!')
  })
}
setup()
```

---

## Contributing


If you find a bug or think that something is hard to understand feel free to open an issue or contact me on twitter [@cvmcosta](https://twitter.com/cvmcosta), pull requests are also welcome :)


And if you feel like it, you can donate any amount of money through paypal, it helps a lot.

[![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffe-blue)](https://www.buymeacoffee.com/UL5fBsi)





---

## License

[![APACHE2 License](https://img.shields.io/github/license/cvmcosta/ltijs)](LICENSE)

---
_Source: https://npm.io/package/ltijs-postgresql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
