Skip to content

athivvat/fastify-clickhouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-clickhouse

js-standard-style

Fastify ClickHouse connection plugin

Install

npm i fastify-clickhouse --save
# or
yarn add fastify-clickhouse

Usage

Add it to your project with register and you are done!

const fastify = require('fastify')()

fasttify.register(require('fastify-clickhouse'), {
    url: 'http://localhost',
    port: 8123,
    debug: false,
    basicAuth: null,
    isUseGzip: false,
    format: "json", // "json" || "csv" || "tsv"
    config: {
        session_id                              : 'session_id if neeed',
        session_timeout                         : 60,
        output_format_json_quote_64bit_integers : 0,
        enable_http_compression                 : 0,
        database                                : 'my_database_name',
    },
});

fastify.get('/user/:id', function (req, reply) {
  const clickhouse = fastify.clickhouse()

  await clickhouse.query().exect()
})

fastify.listen(3000, err => {
  if (err) throw err
  console.log(`server listening on ${address}`)
})

Acknowledgements

This project is kindly sponsored by:

License

Licensed under MIT.

About

Fastify ClickHouse connection plugin

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published