Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/butlerx/fastify-bookshelfjs
bookshelfjs plugin for fastify
https://github.com/butlerx/fastify-bookshelfjs
Last synced: 3 months ago
JSON representation
bookshelfjs plugin for fastify
- Host: GitHub
- URL: https://github.com/butlerx/fastify-bookshelfjs
- Owner: butlerx
- License: mit
- Created: 2017-12-05T19:38:39.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-01-11T03:55:37.000Z (about 2 years ago)
- Last Synced: 2024-04-25T06:21:26.436Z (9 months ago)
- Language: JavaScript
- Size: 553 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fastify - `fastify-bookshelf`
README
# Fastify BookshelfJS Plugin
Bookshelf.js is a Javascript ORM built on top of knex.js. This plugin adds a
shared bookshelf object to fastify that can be accessed from anywhere.## Installation
```
$ yarn add fastify-bookshelfjs# Then add one of the following:
$ yarn add pg
$ yarn add sqlite3
$ yarn add mysql
$ yarn add mysql2
$ yarn add mariasql
$ yarn add strong-oracle
$ yarn add oracle
$ yarn add mssql
```## Usage
```javascript
const bookshelf = require('fastify-bookshelfjs');fastify.register(bookshelf, {
client: 'pg',
connection: {
host: '127.0.0.1',
user: 'your_database_user',
password: 'your_database_password',
database: 'myapp_test',
},
});fastify.get('/', (request, reply) => {
console.log(fastify.bookshelf); // bookshelf object
});
```## Further reading
Bookshelf used knex.js refer to
[knexjs docs](http://knexjs.org/#Installation-client) for connection options.[Bookshelf Docs](http://bookshelfjs.org/)
## Version
v2.0.0
## License
Licensed under [MIT](./LICENSE).