@quillsql/node
v0.9.4
Published
Quill Server SDK for Node.js
Readme
Quill Node SDK
Installation
$ npm install @quillsql/node
# Or, if you prefer yarn
$ yarn add @quillsql/nodeUsage
Instantiate quill with your credentials and add the below POST endpoint.
Note that we assume you have an organization id on the user returned by your auth middleware. Queries will not work properly without the organization id.
const quill = require("@quillsql/node")({
privateKey: process.env.QULL_PRIVATE_KEY,
databaseConnectionString: process.env.POSTGRES_READ,
});
// "authenticateJWT" is your own pre-existing auth middleware
app.post("/quill", authenticateJWT, async (req, res) => {
// assuming user fetched via auth middleware has an organizationId
const { organizationId } = req.user;
const { metadata } = req.body;
const result = await quill.query({
orgId: organizationId,
metadata,
});
res.send(result);
});For local testing (dev purposes only)
Create an .env file with the following key-value pairs:
QUILL_PRIVATE_KEY=
DB_URL=
ENV=development
BACKEND_URL=Use the following commands to start a locally hosted dev server.
npm install
npm run dev-serverYou should be able to ping your local server at http://localhost:3000.
