We'll start with user accounts. You'll remember that in Chapter 2, Building a Photo-sharing Application, when we built the photo sharing application, we created a signin.js
file; we'll want to use that here. We can set this up by following these steps:
Copy the template directory to create a new project, and then copy the
signin.js
file into the new directory. You'll want to add the following line to the top of theserver.js
file:var signin = require("./signin");
Now, as you might recall, this requires a few more Node.js packages. Go ahead and install
passport
,passport-local
, andbcrypt
by using the following command in the terminal:npm install bcrypt passport passport-local --save
The
bcrypt
andpassport-local
packages are used in thesigin.js
file, but we requirepassport
in theserver.js
file; we'll also create theusers
database, as you can see here:var passport = require("passport"); var users = new Bourne("users.json");