Always bet on JavaScript.
Visualisation of npm dependencies by @anvaka.
Before you start you'll probably want to read a bit about Node, the JavaScript engine, and client vs. server-side. We'll cover this in the lab but make sure you fully understand these concept, the resources below can help.
- Introduction to Node.js
- Differences between Node.js and the Browser
- An introduction to the npm package manger
- Frontend vs Backend
🎦 Watch a video about the browser versus Node.js.
🎦 Watch a video about NPM.
You can do these exercises before you start working on the assignments to get comfortable with the topics covered in class. The below are interactive, self guided lesson modules, from freeCodeCamp. If you feel a bit more adventurous you can try the NodeSchool workshoppers.
Learn the basics of node modules and npm packages and setup a boilerplate for your own feature.
- Time: 6:00h
- Goals: subgoal 1, subgoal 2
- Due: before week 2
-
Create the boilerplate for the matching app you are going to create. Include a
package.json
with a correct name, version, dependencies, and other metadata. See npm’s documentation onpackage.json
. For examples ofpackage.json
files, seerepeat-string
,longest-streak
, orskin-tone
. -
Look trough the NPM registry and install a package from npm that would be helpful for your job story and try it out in
index.js
. Not sure what package to pick? You can try playing around withcamelcase
orlodash
to get comfortable requiring packages and using them. -
Improve the developer experience of your application. Look for so called 'developer dependencies' on NPM.
nodemon
is a good example, it will monitor for any changes in your source and automatically restart your server. Perfect for development. -
Create some
run scripts
in yourpackage.json
to start, serve or build your application. -
Some files and folders NPM create don't have to be on GitHub (e.g. node_modules). Create a
.gitignore
, and add files and folders you don't want to push to your GitHub repository. This is the standard GitHub gitignore for Node.js applications. Keep your gitignore concise, only put files and folders in there that need to be ignored.
💡 Configuration files like dotfiles, package.json or server.js are created in the
root
of your repository. There is no need to put them in subfolders.
Ask yourself upon completion:
- How does
require
work under the hood? - What's the difference between
dependencies
anddevDependencies
? - What are the differences between
global
andlocal
dependencies? - What tasks can you run with
npm run scripts
?
Additional resources
🎦 Watch a live demo about NPM and packages.
In this assignment we'll create a basic server that responds with hello world.
- Time: 2:00h
- Goals: subgoal 3, subgoal 4
- Due: before week 2
We'll install Express and create a very basic server that responds to our requests.
- Install
express
and require it inserver.js
- Use http methods to have your server respond with hello world when you open
localhost
. Use the resource below as an example of how to do this.
Ask yourself upon completion:
- The server you just wrote? Where does it live? What happens if you turn off your computer?
- What's
localhost
and how does it defer from a full domain?
Additional resources
-
Push your changes:
Commit your progess in your repository on GitHub under your username in your own matching-app repository. -
Create an issue:
Mark this assignment as complete by opening an issue on our GitHub issue tracker. Fill in the progress report template with your own information. Include what progress you made in the description of the issue. -
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 assignment will be reviewed by teachers and student assistants, so expect people to read it and be ready for tips and tops!