An SSL error has occurred and a secure connection to the server cannot be made.
Exploits of a Mom by @xkcd.
- Where to host a Node.js app
- Error handling in Node.js
- The difference between development and production
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:
- What databases are there?
- How do databases compare to each other in features, type (SQL, NoSQL, or something else?), popularity, funding, ease of use, or other factors?
- Which of those factors do or do not matter to you?
Library by @jzamora.
In this assignment you’ll store the user input in a MongoDB
database.
- Homework
- Time: 8:00h
- Goals: subgoal 8 and subgoal 13
- Due: before lab 5
mongodb-server
(example)- Stuck? See the Bugs section of the course readme to find a list of troubleshooting tips
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 thedotenv
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 your node app to the web!
- Homework
- Time: 2:00h
- Goals: subgoal 11,
- Due: before lab 5
- Stuck? See the Bugs section of the course readme to find a list of troubleshooting tips
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:
- Glitch: Good for demo purposes but there are some restrictions.
- Zeit Now: By far the easiest and fastest way to deploy.
- Platform As A Service: Heroku: Needs more config then Zeit but is more powerful.
- Virtual Private Server DigitalOcean: The most hardcore way to-go. They just provide an empty linux and you need to set-up on your own.
- Make sure you have put your variables
.env
in.gitignore
. Most hosting providers won't look for an.env
file, you'll have to manually type them into your configuration. node_modules
should also be in your.gitignore
.- Update your readme with a description of your app, the latest changes and how-to install
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.
-
Push your changes: Hand in your progess in your repository on GitHub under your username.
-
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. -
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!