Skip to content

Instantly share code, notes, and snippets.

@just-Bri
Created December 29, 2019 18:47
Show Gist options
  • Save just-Bri/2ac13f26c6d00466c50972b9dc5ecf61 to your computer and use it in GitHub Desktop.
Save just-Bri/2ac13f26c6d00466c50972b9dc5ecf61 to your computer and use it in GitHub Desktop.
Spaced Rep API Qs
1. Which database tables are created in the migrations?
2. What are the endpoints for user registration, login and refresh?
3. What endpoints have been implemented in the language router?
4. What is the async and await syntax for? (Hint)
5. Which endpoints need implementing in the language router?
6. How does the GET /api/language endpoint decide which language to respond with? (Hint: Does it relate to the user that made the request?)
7. In the UserService.populateUserWords method, what is db.transaction?
- Hints:
- https://knexjs.org/#Transactions
- https://knexjs.org/#Builder-transacting
- https://www.postgresql.org/docs/8.3/tutorial-transactions.html
- https://www.tutorialspoint.com/postgresql/postgresql_transactions.htm
8. What is SERIAL in the create migration files? (Hint: http://www.neilconway.org/docs/sequences/)
9. What is setval in the seed file? (Hint: https://www.postgresql.org/docs/8.2/functions-sequence.html)
@just-Bri
Copy link
Author

  1. user, language, word
  2. /auth/token, /user, auth/token
  3. get/, get/head, post/guess
  4. running code asynchronously(not holding up the stack/queue)
  5. /language/head and /language/guess
  6. language id associated with the user
  7. transaction is kind of like a begin/end for psql, if something goes wrong it will rollback changes.
  8. auto-inc id
  9. its used in creating a sequence, in our case the next word etc in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment