Since we now have the tests in place and failing, we can change our user and order controllers to start using MongoDB. First, let's change the user controller. The user controller content is as follows:
import { NextFunction, Request, Response } from 'express'import * as halson from 'halson'import { UserModel } from '../schemas/User'import { formatOutput } from '../utility/orderApiUtility'export let getUser = (req: Request, res: Response, next: NextFunction) => { const username = req.params.username UserModel.findOne({ username: username }, (err, user) => { if (!user) { return res.status(404).send() } user = user.toJSON() user._id = user._id.toString() user = halson(user).addLink('self', `/users/${user._id}`) return ...