Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huangang/fastify-sequelize2
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
https://github.com/huangang/fastify-sequelize2
fastify fastify-plugin
Last synced: 16 days ago
JSON representation
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
- Host: GitHub
- URL: https://github.com/huangang/fastify-sequelize2
- Owner: huangang
- Fork: true (lyquocnam/fastify-sequelize)
- Created: 2019-07-24T05:37:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T06:46:53.000Z (over 5 years ago)
- Last Synced: 2025-01-06T09:25:53.745Z (about 1 month ago)
- Topics: fastify, fastify-plugin
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fastify-sequelize2
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)## install
```bash
npm install fastify-sequelize2
```## Usage
```javascript
const fastify = require('fastify')()
const fsequelize = require('fastify-sequelize2')const sequelizeConfig = {
instance: 'sequelize', // the name of fastify plugin instance.
autoConnect: true, // auto authentication and test connection on first run
// other sequelize config goes here
dialect: 'sqlite',// SQLite only
storage: 'path/to/db.sqlite'
}fastify
.register(fsequelize, sequelizeConfig)
.ready()fastify.listen(3000, () => {
console.log('> listening on port 3000')
})
```
- `instance`: *(optional)* the name of instance will be mapped to fastify, default is `sequelize`
- `autoConnect`: `default: true` auto authentication and test connection on first run.
- `sequelizeConfig`: all sequelize configurations, you can see [here](http://docs.sequelizejs.com/manual/installation/getting-started.html#setting-up-a-connection).