In this lesson we’ll create a model for study groups, create a router that facilitates the creation of study groups, and test the endpoint. The code for this lesson will be written and discussed in class. Tasks Create a Days of Week Module Create a StudyGroup Model Create a StudyGroup Router Register the StudyGroup Router […]
In this tutorial we’ll create two new endpoints (POST /user/login and PATCH /user/logout) that will allow users to log into the app and log out. The POST /user/login endpoint handler will expect an email address and password in the body of the request. We’ll use a static method on the User model to check that […]
In the last tutorial we created an instance function named generateAuthToken() that creates authorization tokens and a middleware function named auth() that verifies that an authorization token belongs to a user in the database. We also made changes to POST /user to generate an auth token and passed it to sendVerificationEmail(). In this tutorial we’ll […]
We don’t want arbitrary users to be able to log a user out, or worse, modify or delete a user’s profile. Therefore we need to create a process to authenticate a user and a way for a user to prove that they are authorized to perform certain actions like modify and delete their own profile. […]
In the last chapter, we created a model for the user entity and built an endpoint that clients can use to create new accounts. A client will send an object containing the user’s information to the endpoint and the router will create an instance of the User model, and save it as a document in […]