Week 1 Server Side Rendering 📡 - sanneduinkerx/progressive-web-apps-2021 GitHub Wiki

TO DO LIST THIS WEEK:

  • Get server up and running
  • Use template engine ejs for node application
  • fetch data from API with node-fetch
  • Read into theory node.js and express, server side rendering with videos and articles

Plan of action: How to get server up and running

  • download and install node.js - npm is included

  • npm install and node install

  • npm init -> make package.json

  • then npm install express --save -> to save to dependencies in package.json

  • add to index.js file:

    // module imported express
    const express = require('express')
    
    const app = express()
    
    //port to listen to in browser
    const port = 3000
    
    // starting page, req -> request and a respond
    app.get('/', (req, res) => {
    //sends response to browser
    res.send('Hello World!!!')
    })
    
    app.listen(port, () => {
    // log in terminal with message that de web server is running
    console.log('Example app listening at http://localhost:${port}')
    })
    
  • in command line node index.js or npm run start, to run web server

Feedback from Peers:

  • Try to separate your process from your wiki, you could try using github projects for to-do's, Works like trello
  • Focus your readme content on your concept
  • Try to create modules for your server-functions
  • in your ejs, you can include the head element in your head partial just like a footer element in your footer (preference)
  • WAFS client side to get dynamic data -> to server side.
  • Add previous written CSS and JS from WAFS to this project
  • Basic tooling with npm script