You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,10 @@ We use controllers to keep our router thin. The controller's responsibility is t
109
109
110
110
Here is our database setup. This project uses Knex to manage migrations and execute queries. I initially wrote wrote all the MySQL calls using raw SQL, but the need for a migrations maanager pushed me towards an ORM for the MySQL database. Knex is awesome - very powerful, easy to use and make queries, and the migrations are nice to have for sure - especially for testing.
111
111
112
+
For this project you'll need to make two databases in your development environment, `koa_vue_notes` and `koa_vue_notes_testing`. In your production environment you would just have `koa_vue_notes`. Tests use a different database because the data there is extremely volatile - as table information is created and destroyed on every test.
113
+
114
+
The `knexfile.js` in the root of the project is all setup with the ability to read your `.env` file. Let's say you download this project - first you'll `npm install`, then create a `koa_vue_notes` database and a `koa_vue_notes_testing` database, then `knex migrate:latest` and `knex seed:run` to create and seed your tables. Currently it's set up to make five users and 100 notes distributed to those users.
115
+
112
116
### middleware
113
117
114
118
Here I place any custom middleware the app is using. The custom middleware we're using is based on the `koa-jwt` library - but I had to tweak it because it mysteriously didn't report an expired token correctly. Strange, as I thought that would be an important requirement. No biggie.
@@ -129,6 +133,10 @@ Static files - just used for the favicon.
129
133
130
134
index.js isn't a folder - it's the brain of the app. Here you'll see we are attaching a bunch of middleware to our Koa instance. Very slick and straight-forward.
131
135
136
+
## Todo
137
+
138
+
- Finish writing all the tests
139
+
132
140
## Hit Me Up
133
141
134
142
Go ahead and fork the project! Message me here if you have questions or submit an issue if needed. I'll be making touch-ups as time goes on. Have fun with this!
0 commit comments