fastify-arangodb
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

fastify-arangodb

Greenkeeper badge Build Status

Fastify ArangoDB plugin, with this you can share the same arangodb instance pool in every part of your server.

Under the hood the official arangojs driver is used, the options that you pass to register will be passed to the ArangoDB client. Passing an object to options is required.

Install

npm i fastify-arangodb --save

Usage

Add it to you project with register and you are done! You can access the Arango instance via fastify.arango

const fastify = require("fastify")();
 
fastify.register(require("fastify-arangodb"), {
  url: "http://root:root@localhost:8529",
  database: "auth"
});
 
fastify.get("/user/:id", async (req, reply) => {
  const collection = fastify.arango.collection("users");
  collection.document(req.params.id).then(user => {
    reply.send(user);
  });
});
 
fastify.listen(3000, function() {
  fasitfy.log(`server listening on ${fastify.server.address().port}`);
});

License

Licensed under ISC.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    1
    • latest

Version History

Package Sidebar

Install

npm i fastify-arangodb

Weekly Downloads

1

Version

4.0.0

License

ISC

Unpacked Size

6.36 kB

Total Files

9

Last publish

Collaborators

  • timmak