hsynlms / sequelize-fastify Goto Github PK
View Code? Open in Web Editor NEWA Sequelize plugin for Fastify.
License: MIT License
A Sequelize plugin for Fastify.
License: MIT License
According to the Sequelize v6 API Documentation, the host
and port
keys should be top level, but the documentation for this library shows them nested in a deeper options
instance.
For example:
await fastify.register(
sequelizeFastify,
{
instance: 'db',
sequelizeOptions: {
dialect: 'DIALECT_NAME',
database: 'DATABASE_NAME',
username: 'DATABASE_USER_NAME',
password: 'DATABASE_USER_PASSWORD',
options: { // This nesting level appears incorrect
host: 'DATABASE_HOST_OR_SERVER',
port: 'DATABASE_PORT'
}
}
}
)
await fastify.register(
sequelizeFastify,
{
instance: 'db',
sequelizeOptions: {
dialect: 'DIALECT_NAME',
database: 'DATABASE_NAME',
username: 'DATABASE_USER_NAME',
password: 'DATABASE_USER_PASSWORD',
host: 'DATABASE_HOST_OR_SERVER', // nested at same level as other options
port: 'DATABASE_PORT' // nested at same level as other options
}
}
)
I removed that line of code and It started working again.
I decided to go ahead with this plugin, only to find out that there's no documentation telling how and where to define models.
There is a define
method available on the instance, but however that doesn't help as there's no elaborate constructor or method to define models. Please help.
This library needs more exemples for use orm and exemples with databases
FastifyError [Error]: fastify-plugin: sequelize-fastify - expected '3.x' fastify version, '4.0.0' is installed
at Object.checkVersion (/project/node_modules/fastify/lib/pluginUtils.js:108:11)
at Object.registerPlugin (/project/node_modules/fastify/lib/pluginUtils.js:123:16)
at Boot.override (/project/node_modules/fastify/lib/pluginOverride.js:28:57)
at Plugin.exec (/project/node_modules/avvio/plugin.js:80:33)
at Boot.loadPlugin (/project/node_modules/avvio/plugin.js:273:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
statusCode: 500
}
Some TypeScript declarations would help with development in TS. If anyone wants I can implement this myself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.