1.0.0 • Published 3 years ago

arango-express v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

arango-express

This is a middleware that attaches query and transaction functions to the Express request object.

Install

npm install arango-express

Usage

const { arangodb } = require('arango-express')
const express = require('express')

const app = express()

app.use(
  arangodb({
    db: 'mydb',
    as: {
      username: 'mike',
      password: 'secret',
    },
  }),
)

app.get('/', async function (req, res) {
  const cursor = await req.query`RETURN CURRENT_USER()`
  const dbuser = await cursor.next()
  res.send(`Hello from ${dbuser}!')
})