Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nestjsplus/knex-cats
Sample app using @nestjsplus/knex
https://github.com/nestjsplus/knex-cats
Last synced: about 2 months ago
JSON representation
Sample app using @nestjsplus/knex
- Host: GitHub
- URL: https://github.com/nestjsplus/knex-cats
- Owner: nestjsplus
- License: mit
- Created: 2019-09-21T21:58:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T11:00:42.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T18:24:59.649Z (almost 2 years ago)
- Language: TypeScript
- Size: 635 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Sample App for @nestjsplus/knex
### What?
This is a standalone sample app showing how to use the [@nestjsplus/knex](https://github.com/nestjsplus/knex) package for integrating [Knex.js](http://knexjs.org) with [Nest](https://nestjs.com). You may also want to read about [building dynamic modules in NestJS](https://dev.to/nestjs/advanced-nestjs-how-to-build-completely-dynamic-nestjs-modules-1370), and a [custom schematic for generating modules based on that pattern](https://dev.to/nestjs/build-a-nestjs-module-for-knex-js-or-other-resource-based-libraries-in-5-minutes-12an).
You can clone and install it, and examine the source code to learn how to use the package.
The `src/app.controller.ts` file and `src/app.service.ts` files also demonstrate how to use a few basic Knex.js features.
### Installation
> git clone https://github.com/nestjsplus/knex-cats
Creates a folder called `knex-cats`
> cd knex-cats
#### Supply credentials
This example assumes you have a PostgreSQL installation available. You'll need to add the PostgreSQL database credentials.
The example uses [NestJS Configuration Manager](https://github.com/nestjsplus/config) to supply environment variables to the app. It's set up to expect a `development.env` file in a folder called `config` at the root level (a sibling to `src`). (You can change any of these settings, or use more features of *NestJS Configuration Manager* by reading the docs, or hard code your credentials, or use another config manager, etc.).
The `development.env` file should look like this:
```
host=
port=
database=
user=
password=
```#### Install dependencies and run
> npm install
> npm run start:dev
See [the docs](https://github.com/nestjsplus/knex) for more.
### Change Log
See [Changelog](CHANGELOG.md) for more information.
### Contributing
Contributions welcome! See [Contributing](CONTRIBUTING.md).
### Author
**John Biundo (Y Prospect on [Discord](https://discord.gg/G7Qnnhy))**
### License
Licensed under the MIT License - see the [LICENSE](LICENSE) file for details.