Skip to content

datawok/fastify-sequelize-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fastify Sequelize Plugin

import * as fp from 'fastify-plugin';
import { fastifySequelize } from 'fastify-sequelize-plugin';

const fastifySequelizeOptions: FastifySequelizeOptions<HttpServer, RawRequest, RawResponse> = {
  sequelize: {
    dialect: 'postgres',
    logging: false,
    host: process.env.POSTGRES_HOST,
    port: Number.parseInt(process.env.POSTGRES_PORT),
    database: process.env.POSTGRES_DATABASE,
    username: process.env.POSTGRES_USERNAME,
    password: process.env.POSTGRES_PASSWORD,
    models: [],
  },
};

const fastifySequelizePlugin = fp<
  HttpServer,
  HttpRequest,
  HttpResponse,
  FastifySequelizeOptions<HttpServer, HttpRequest, HttpResponse>
>(fastifySequelize);

this.fastify.register(fastifySequelizePlugin, fastifySequelizeOptions);

Releases

No releases published

Packages

No packages published