Closed jeffersonest closed 6 years ago
Thanks for your question. I have put together an example. I hope it helps. I have also published this example in the readme of this repository.
The example contains migrations, models and a config .env
file.
The main.js
file contains code that creates a user and a group and then fetches the data from the database and prints it out.
Steps:
npm install
command or yarn
(if you have yarn installed) in the folder where you extracted the zip,npm install knex -g
command,be_example_schema
(it is recommended that you pick the utf8_unicode_ci
as the default collation),.env
file and set your mysql password,knex migrate:latest
command in the folder where you extracted the zip,main.js
file with the node main.js
command or with your favourite debugging tool.For more examples you can check out the test files in this repository.
How to create a models?