Introduction
We will build a todo list app in this tutorial, complete with functionality that allows users to sign in with email. By following along with this tutorial, you will learn how to use Passport for authentication.
If you want to see where we are headed, here's an example of the final result: https://github.com/passport/todos-express-email
Before we dive in, you'll need a working development environment with Node.js and Git, as well as an editor and terminal of your choosing. Take a moment to set up these tools if you have not already done so.
You'll also need a SendGrid account. If you don't already have one, sign up now. This tutorial can be completed using SendGrid's free plan.
Let's get started!
We are going to start with a starter app, which has all the scaffolding needed to build a todo list. Let's clone the app:
$ git clone https://github.com/passport/todos-express-starter.git email-tutorial
You now have a directory named 'email-tutorial'
. Let's cd
into it:
$ cd email-tutorial
Take a moment browse through the files in the starter app. As we work through this tutorial, we'll be using Express as our web framework, along with EJS as our template engine and CSS for styling. We will use SQLite as our database for storing data. Don't worry if you are not familiar with these technologies -- the necessary code will be provided at each step.
Now, let's install the dependencies:
$ npm install
And start the server:
$ npm start
Let's check to see if its working. Open http://localhost:3000 in your browser. You should be greeted with a page explaining how todos help you get things done.
Next, we will add a login page to the app.