Learning Molecules

Once you got started by attending a Beginner's Track session, you may choose from any of the workshopper modules listed on the NodeSchool page.

In order to facilitate discussions with peers in a NodeSchool Passau workshop, we provide what we call "Learning Molecules" - ideas for tiny projects you may work on, instead of or in addition to the workshopper modules.

In all NodeSchool Passau workshops, a mentor will present one of these Learning Molecules to introduce you to the main topics of the molecule.

Learning Molecule: JSON Server

When you build a web app, you'll probably want to be able to demonstrate the app without writing a full-blown backend. JSON Server is an npm module which facilitates exactly this.

Steps:

  1. create a new folder for this project
  2. create a package.json file by running yarn init -y
  3. add JSON Server: yarn add json-server
  4. add a script entry to your package.json: "scripts": { "start": "json-server --watch db.json" }
  5. Follow the post Create a REST API With JSON Server

Learning Molecule: HTTP Server

When you start building HTTP-based applications in Node.js, the http/https modules are the ones you will interact with. Now, let's create your first Node.js HTTP server and learn more about the http/https and express module.

Steps:

  1. create a new folder for this project
  2. create a package.json file by running yarn init -y
  3. Follow the post Node Hero - Your First Node.js HTTP Server
  4. Use yarn instead of npm

Learning Molecule: HTTP Requests

External APIs can be important sources for your application. Send requests to get the relevant informations and show it on your website.

Steps:

  1. Create a new folder for this project
  2. Create a package.json file by running yarn init -y
  3. Follow the post Node Hero - Node.js Request Module Tutorial
  4. Use yarn instead of npm
  5. Because we don’t have an access key for accuweather, adjust the described solution to use weather api from yahoo. The relevant Endpoint is described here: Yahoo Weather API
  6. The server should be reachable via http://localhost/passau and display e.g.

    Hello, the weather for passau is Cloudy, with 65°F

  7. For alternate ways of implementing HTTP requests with Node.js, read the article 4 ways for making HTTP(S) requests with Node.js
  8. We recommend using the module node-fetch, because the fetch api is a modern api implemented in all browsers for making HTTP requests from JavaScript
  9. Read about the browser Fetch API, create a small HTML page and make a request to the weather api (using a hard-coded path) from within the web page

Learning Molecule: Cheerio

With the Node.js module cheerio you can load the html part of a website into your Node.js function and work with it like an object. In this tutorial you scrap the news from a website and display it in the console.

Steps:

  1. create a new folder for this project
  2. create a package.json file by running yarn init -y
  3. add JSON Server: yarn add json-server
  4. Follow the post How To Use node.js, request and cheerio to Set Up Simple Web-Scraping
  5. Adjust your solution to use your favorite request module instead of the request module