Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Latest commit

 

History

History
138 lines (96 loc) · 6.53 KB

week-1.md

File metadata and controls

138 lines (96 loc) · 6.53 KB

Week 1

Always bet on JavaScript.

@BrendanEich

Visualisation of npm dependencies by @anvaka.

Table of Contents

Slides

Theory

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.

🎦 Watch a video about the browser versus Node.js.
🎦 Watch a video about NPM.

Playground

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.

Assignments

Package

Package Banner

Learn the basics of node modules and npm packages and setup a boilerplate for your own feature.

Synopsis

  • Time: 6:00h
  • Goals: subgoal 1, subgoal 2
  • Due: before week 2
  1. 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 on package.json. For examples of package.json files, see repeat-string, longest-streak, or skin-tone.

  2. 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 with camelcase or lodash to get comfortable requiring packages and using them.

  3. 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.

  4. Create some run scripts in your package.json to start, serve or build your application.

  5. 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 and devDependencies?
  • What are the differences between global and local dependencies?
  • What tasks can you run with npm run scripts?

Additional resources

🎦 Watch a live demo about NPM and packages.

Serve

Hello World Server banner

In this assignment we'll create a basic server that responds with hello world.

Synopsis

  • Time: 2:00h
  • Goals: subgoal 3, subgoal 4
  • Due: before week 2

Assignment

We'll install Express and create a very basic server that responds to our requests.

  1. Install express and require it in server.js
  2. Use http methods to have you server respond with hello world when you open localhost

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

Hand-in

  1. Push your changes:
    Commit your progess in your repository on GitHub under your username in your own matching-app repository.

  2. Create an issue:
    Mark this assignment as complete by opening an issue on our GitHub issue tracker. Fill in the issue template of week-1.md with the correct information. Include what progress you made in the description of the issue.

  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 assignment will be reviewed by teachers and student assistants, so expect people to read it and be ready for tips and tops!