A Fastify plugin that simplifies access to the ClickHouse client.
Code rewritten from Fastify Prisma plugin to instead use the ClickHouse client.
NPM
npm i fastify-clickhouseYarn
yarn add fastify-clickhouseYou can register it with the clickhouse client config
importfastifyClickHousefrom'fastify-clickhouse';awaitserver.register(fastifyClickHouse,{clientConfig: {url: 'localhost:8123',username: "USERNAME",password: "PASSWORD"}});Or pass a ClickHouse client instance
import{createClient}from'@clickhouse/client';constclickhouse=awaitcreateClient({url: 'localhost:8123',username: "USERNAME",password: "PASSWORD"});server.register(fastifyClickHouse,clickhouse);