be-course-18-19

Week 4

An SSL error has occurred and a secure connection to the server cannot be made.

William Shakespeare

Table of Contents

Inspiration

qw3rtman/git-fire by @qw3rtman.

Comic

Exploits of a Mom by @xkcd.

Slides

Theory

Assignments

Alternatives

Take about 0:45h to investigate the different types of database. What databases are out there, and how can they be categorised? Why do you think we picked MongoDB?

Make sure your research answers questions like:

Homework

Storage

Library by @jzamora.

In this assignment you’ll store the user input in a MongoDB database.

Synopsis

Tips

Description

Take ± 8 hours to add an MongoDB database to your project.

All of your data is going to be stored in a database called MongoDB. You have two options: go with a database as a service DBaaS or use MongoDB locally. You can use a MongoDB GUI to see and manipulate your data.

Store sensitive information such as your database URI, password and username in a .env using the dotenv package. Make sure you add the file to your .gitignore. If you commit your environment variables it’s hard to undo!

Local

When you are running locally, make sure you create a folder for MongoDB to store data and specify this path when starting mongod.

You can store this ./data folder inside of your repository but make sure to put it in your .gitignore.

mongod --dbpath <path to data directory>

Have a look at the mongodb-server example for more detailed instructions.

DBaaS

After you’ve tested your database locally you can migrate to a Database as a service. Instead of having the database stored locally on your laptop, it saves your data to the cloud.

MongoDB Atlas and Mlab are both good options. They offer free plans for prototypes. These are not meant to be used in production.

Build

You can use the mongodb package inside node to interface with your database. Additionally you can use mongoose it makes it a bit easier to model and your database.

Research

Include a diagram in your readme that explains how the database works (hint: Google Drawings).

Deploy (feature)

Deploy your node app to the web!

Synopsis

Tips

Description

Take ± 2 hours to deploy your web app to a hosting service. People will actually be able to publicly access your app using an url in their browser. There are lots of different options but we recommend using the following:

Preparation

Hand in

Commit your work early and often. Push your work to GitHub. Don’t worry if it’s not perfect. Try and get as far as you can.

  1. Push your changes: Hand in your progess in your repository on GitHub under your username.

  2. Create an issue: Mark this assignment as complete by opening an issue on our GitHub issue tracker. Fill in the issue template with the correct information. Make sure, in your repository, you include the resources used and update your readme.md and wiki with additional information.

  3. Feedback: Let us know what you thought of the homework, what part you spend a lot of time on and give us any feedback. Your project will be reviewed and receive feedback, so expect people to read it, and be ready for tips and tops!