This chapter is intended to revisit the previous implementation, this time saving our data in a persistent storage (database). It will also cover authentication, and unit testing and hosting as additional good-to-know concepts (but not essential). It is therefore prudent to put more emphasis on working with the DB using knex.js and authenticating your API with JWT.
By the end of this chapter, you will be able to:
- Implement database connection with Knex.js
- Describe commonly used Knex.js methods
- Rewrite our previous implementation of the todo routes with Knex.js
- Implement API authentication with JWT
- Describe the importance of having unit tests for your API
- Implement basic testing of the API with Lab