CRUD – reading user and project data
Now we're going to go through the main three static methods for a specific use case in our application. We'll also wrap one of these inside a custom static method that we are going to create.
findOne() – finding a single user
First up, let's add the ability for a returning user to log in. At this moment we are not using any type of authentication. This is intentional as there is a plethora of options out there for password hashing and encryption, using OAuth or social network accounts. While there are several node modules available to help with this, it will just prove a distraction while we're building the bare bones of our app. For now, while we're putting it together we'll stick to just entering an e-mail address to enable us to switch between users.
The routes we're going to use are in the following code snippet:
app.get('/login', user.login); // Login form app.post('/login', user.doLogin); // Login action
Login form
The first step is to...