arango-express

express middleware that talks to ArangoDB

Usage no npm install needed!

<script type="module">
  import arangoExpress from 'https://cdn.skypack.dev/arango-express';
</script>

README

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}!')
})