Please help us improve and share your feedback! If you find better tutorials or links, please share them by opening a Pull Request.
For almost any web application, it is essential to have a backend. The backend is a place where we, the developers, can store our data, communicate with users and let the users communicate with us, do smart things like calculations, data processing etc.
There are many languages for this. We might've heard of Java, C, C++, Go, Python, Ruby, PHP and the list goes on. There are two reasons why we at HYF choose Node.JS over others:
- You already know JavaScript, so it's easier to get started than other languages
- Node.js is great for making web APIs because it is asynchronous by nature and thus allows for high input/output. By this we mean that it allows many users to make very light requests at the same time.
In this 3-week module, we will use NodeJS to create and connect both the backend api and serve the frontend html, css and javascript. Most of this course will focus on the backend part. Meaning building a webserver that has an api connected to a database.
Database <--> Webserver
Week | Topic | Preparation | Homework | Lesson plan |
---|---|---|---|---|
1. | HTTP Introduction to node js Simple webserver |
Preparation | Homework | Lesson plan |
2. | Express | Preparation | Homework | Lesson plan |
3. | Database connection API |
Preparation | Homework | Lesson plan |
We will build on knowledge from the following HYF (sub)modules. If we feel we have gaps we should review the curriculum ourselves or ask a teacher to help.
- What is Node.js?
- Using Node Package Manager (NPM)
- Using
import
to include modules - Using
express
to make a RESTful API - Using
mysql
to connect the API to the backend - Postman
If you have the time, you could follow another simple set of exercises to get a better grasp of Node.js and some more practice. Feel free to bring any questions from this to the class or raise them on slack!
Clone the repository that holds the exercises templates: https://github.com/HackYourFuture-CPH/Nodejs-exercise-template.git
See each week's readme.md
and follow the instructions to setup the server.