New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fastify-sqlite-typed

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-sqlite-typed

Fastify-sqlite-plugin

latest
Source
npmnpm
Version
5.0.2
Version published
Maintainers
1
Created
Source

Fastify SQLite Typed Plugin

Beta npm version js-standard-style License

SQLite integration plugin for Fastify

Effortlessly incorporate SQLite databases into your Fastify applications using fastify-sqlite-typed. This plugin leverages node-sqlite3 and node-sqlite for effective database operations.

For Fastify V 4.X.X click here

Additional Resources

Features

  • Seamless integration with Fastify applications
  • Configurable SQLite driver
  • Multiple database modes supported
  • Debugging capabilities with query tracing
  • Support for both in-memory and disk-based databases

Installation

npm install fastify-sqlite-typed
# or
yarn add fastify-sqlite-typed

Usage

Import and register the plugin with your Fastify instance, and execute a sample query:

import fastify from "fastify";
// With fastify-plugin
import { fpSqlitePlugin } from "fastify-sqlite-typed"; 
// Without fastify-plugin
// import { sqlitePlugin } from "fastify-sqlite-typed";

const app = fastify();

app.register(fpSqlitePlugin, {
  dbFilename: "./myDB.db",
  // additional options
});

// Example query
app.get("/users", async (request, reply) => {
  const users = await app.db.all("SELECT * FROM users");
  reply.send(users);
});

fastify.listen({ port: 3000 }, (err, address) => {
  if (err) throw err
})

Options

OptionDescriptionTypeDefault
dbFilenamePath to the database file (:memory: for in-memory, "" for disk-based).StringNone
modeDatabase mode, combining Dbmode values.DbmodeREADWRITE | CREATE | FULLMUTEX
driverSettingsSettings for the SQLite driver (see DriverSettings below).ObjectDefault settings

DriverSettings

OptionDescriptionTypeDefault
verboseEnables verbose mode for detailed stack traces.Booleanfalse
cachedEnables database object caching.Booleanfalse
traceFunction to run on each query execution.FunctionNone

License

Licensed under MIT.

FAQs

Package last updated on 16 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts