Book Image

Node.js By Example

Book Image

Node.js By Example

Overview of this book

Table of Contents (18 chapters)
Node.js By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Finding friends


The process of finding friends involves a series of changes in our current codebase. The following sections will guide us through the searching and displaying of friend profiles. We will make a couple of improvements in our REST API and define a new controller and model.

Adding the search page

So far, we have pages for registration, login, and profile management. We will add one more link in our navigation—Find friends. In order to do this, we have to update the frontend/tpl/navigation.html file as follows:

<li class="right"><a on-click="goto:logout">Logout</a></li>
<li class="right"><a on-click="goto:profile">Profile</a></li>
<li class="right"><a on-click="goto:find-friends">Find  friends</a></li>

The link that we added at the end will forward the user to a new route. As with the other pages, our router will catch the URL change and fire a handler. Here is a little update of the app.js file:

Router
.add(...