Adding the MongoDB Heroku addon

We are not done yet. If you go to the URL printed in the console where your app is hosted on Heroku, you will note that it is broken and shows an Application error page, as follows:

The reason this is happening is because we have not created a MongoDB service and passed the URL to the service to our app so that our Vapor app can connect to it. This can be easily resolved by running the following command in the Terminal, which will create a free MongoDB server instance for our app and restart our app:

$ heroku addons:create mongolab:sandbox

Ensure that you verify your Heroku account by adding a Credit Card, if ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.