# Handling AJAX Calls With Node.js and Express (Part 3)

Here is an index of all the articles in the series that have been published to date:

Right now we have a working application, with simple functionality: enter a search keyword, scrape Craigslist, append search results to the DOM via Handlebars:

Let’s pause for a minute and think about the end goal of this application. We want users to be able to search, save, and apply for jobs. We’ll discuss this in greater detail in the next post, but for now, let’s go ahead and add user authentication via Passport as well as MongoDB.

## Setup

Open your terminal, navigate to your project’s root directory, and then install the following packages:

Once installed, require the dependencies in “app.js”:

Finally, open a new terminal window, install mongoDB globally, then run the mongo daemon:

## Update app.js

Add the following code, just below the development config section:

Next, update the routes:

Go through this code slowly to make sure you understand at a high-level what’s going on. Comment if you have questions.

Then update the middleware to handle sessions and passport initialization:

Since we now have several more routes, let’s get our views straightened out.

First, rename “index.jade” to “search.jade” since the searching actually happens on a different route. Update the code to include a logout option:

Before we add Mongo, fire up the server and test everything. If you run into an error, be sure to double check your code with my code from this blog post or the repository (link below).

## MongoDB

Add/update the following code in “app.js”:

## Test again

Fire up the server, then login.

Next, open a new terminal window and type the following commands:

Here we connected to the Mongo database, craigslist, then searched the collection and found the created user. You should see the same thing if all went well.

## Conclusion

Grab the final code from the repo found here. Ask questions. <3 Next time we’ll be taking a step back to create user stories and reorganize our codebase. Perhaps we’ll even get to some testing!