Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lyquocnam/fastify-sequelize
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
https://github.com/lyquocnam/fastify-sequelize
fastify fastifyjs-plugin mssql mysql nodejs postgres sequelize sqlite
Last synced: about 1 month ago
JSON representation
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
- Host: GitHub
- URL: https://github.com/lyquocnam/fastify-sequelize
- Owner: lyquocnam
- Created: 2017-10-31T08:11:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-11T08:42:07.000Z (over 2 years ago)
- Last Synced: 2024-04-12T16:33:58.716Z (8 months ago)
- Topics: fastify, fastifyjs-plugin, mssql, mysql, nodejs, postgres, sequelize, sqlite
- Language: JavaScript
- Size: 10.7 KB
- Stars: 23
- Watchers: 3
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-fastify - `fastify-sequelize` - > Sqlite, Mysql, Mssql, Postgres). (<h2 align="center">Awesome Fastify</h2> / <h2 align="center">Ecosystem</h2>)
README
# fastify-sequelize
Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
## install
```bash
npm install fastify-sequelize
```## Usage
```javascript
const fastify = require('fastify')()
const fsequelize = require('fastify-sequelize')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).