# REST API with KoaJS and MongoDB (Part - 3)

DevFeed: [REST API with KoaJS and MongoDB (Part - 3)](<https://devfeed.tech/articles/rest-api-with-koajs-and-mongodb-part-3-26290.md>)

Original publisher: [Read original article](<https://masnun.com/rest-api-koajs-mongodb-part-3/>)

Author: masnun

Published: 2017-08-09T09:47:16Z

Content type: tutorial

Language: en

Sources: [Abu Ashraf Masnun](<https://devfeed.tech/sources/abu-ashraf-masnun.md>)

Topics: [JSON Web Tokens](<https://devfeed.tech/topics/jwt.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [JSON](<https://devfeed.tech/topics/json.md>), [CRUD](<https://devfeed.tech/topics/crud.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [crud](<https://devfeed.tech/tags/crud.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [jwt](<https://devfeed.tech/tags/jwt.md>), [koajs](<https://devfeed.tech/tags/koajs.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [nodejs](<https://devfeed.tech/tags/nodejs.md>), [rest](<https://devfeed.tech/tags/rest.md>)

## AI overview

Part 3 of a KoaJS and MongoDB REST API series explains how to add authentication with JSON Web Tokens, install JWT-related packages, secure routes with middleware, and return JSON authentication errors.

## Source excerpt

In Part -1 of this series, we saw how we can get started with KoaJS and in Part - 2 we built CRUD endpoints with MongoDB. In this part, we're going to work with authentication. We will be using JSON Web Tokens aka JWT for the auth part. We have written detailed pieces on JWT before. You [...] The post REST API with KoaJS and MongoDB (Part - 3) appeared first on Abu Ashraf Masnun.