dashql
v0.0.4
Published
dashQL is a field-level caching tool that utilizes redis
Downloads
3
Readme
About
dashQL is a lightweight GraphQL caching tool utilizing Redis to cache queries at the field level to further improve reponse time and decrease the number of redundant requests required
Features
- Allows for caching at the field level from the GraphQL abstract syntax tree
- Ability to handle query requests both with and without an argument
- Ability to cache deeply nested queries
Getting Started
- Install redis and define host and port in server file
const redisClient = redis.createClient({
host: "localhost",
port: 6379,
});
- Download dashQL as an npm module and save it to your package.json as a dependency
npm install dashql
- Import dashQL into server file
const dashClass = require('dashQL');
- Add URL (or port number if using localhost) to and ENV file
URL=example.com
// Optional port number
PORT=8080
- Create an instance of dashQL by passing in redisClient in server file
const dashQL = new dashClass(redisClient);
- On your server file which handles graphQL requests, name the endpoint '/dashQL' and put in dashQL as your middleware and return res.locals back to client
app.use('/dashQL', dashQL, (req: Request, res: Response) => {
return res.status(200).send(res.locals.dashQL);
});
- Enjoy significantly faster response times specifically at the field level not just per query string!
Authors
Dan Bonney LinkedIn | Github
Meredith Fronheiser LinkedIn | Github
Kevin Klochan LinkedIn | Github
Drew Williams LinkedIn | Github