Tutorial: Implementing Models

Integrating Models

Models are an integral part of programming which binds the instructions from the controller to be displayed in the view.  In this tutorial we will integrate a user model in to our API and expose some useful endpoints.

This article is part of the ‘Developer Series’ and is intended for software developers undertaking the challenge of correct API design.  Throughout the series the developer will gain knowledge and build confidence around the industry practiced methodologies relating to the planning, design and development of application programming interfaces.

In our previous tutorial we made use of PassportJS to give rise to a system of authentication and we made further use of JSON web tokens to bring about a mechanism for token-based authentication.

In this tutorial we will make further extensions to PassportJS by making use of a real data source.  To accomplish this we will create a programmatic model of the data source and use it during our authentication routines.  Additionally this tutorial will highlight:

For this tutorial we will be designing a basic utility API to demonstrate how we can group logical functions in to a single controller.  This API will be used to provide information on IP addresses and domain names.

Up Next: Extending PassportJS

Pages: 1 2 3 4 5

Written by YourAPIExpert