πŸ§‘πŸ½β€πŸ€β€πŸ§‘πŸ½ day-plan

✍🏽 Register

Energiser

Every session begins with an energiser. Usually there’s a rota showing who will lead the energiser. We have some favourite games you can play if you are stuck.

  1. Traffic Jam: re-order the cars to unblock yourself
  2. Telephone: draw the words and write the pictures
  3. Popcorn show and tell: popcorn around the room and show one nearby object or something in your pocket or bag and explain what it means to you.

CRUD Workshop πŸ”—

Learning Objectives

CRUD 101

Requirements

Today we will build a CRUD API. CRUD stands for Create, Retrieve,* U*pdate, Delete. If you think about it, this is what most applications do:

Create some “resources” Retrieve them (GET them) Update them Delete them

🎯 Workshop Objective

Our API will manage BeyoncΓ© albums. It will:

Create a new album, Retrieve a list of albums or a single album, Update an existing album’s information Delete an album

We will build these endpoints:

  1. GET /albums should return all the albums
  2. GET /albums/:albumId should return a single album (that matches the passed albumId)
  3. POST /albums should save a new album
  4. DELETE /albums/:albumId should delete the album (that matches the passed albumId)

1. GET /albums should return all the albums

In server.js, create a GET /albums endpoint that returns all the albums. Some albums have been provided for you in albums.json.

app.get("/albums", (req, res) => {
  res.send(albumsData);
});

πŸ§ͺ Run and test

  1. npm run dev
  2. Open Postman
  3. Make a GET request to http://localhost:3000/albums

2. GET /albums/:albumId should return a single album (that matches the passed albumId)

Sometimes, we do not want to list all the information in one request, maybe we only want to get the information related to a single album. Imagine if we have a page to display the details of one album. We could call the server and get all albums then filter the one we need client-side. It would be more effective to tell the server to just return the one album we are interested in.

We will now add a new endpoint to return only a single album GET /albums/:albumId. In this case, albumId will tell us what album we can return. The call will be GET /albums/10 and that will return the album with that has albumId: "10".

This endpoint has something different. The endpoint /albums/:albumId has a dynamic part. The albumId will vary depending on what the client sends.

In server.js, create a GET /albums/:albumId endpoint that returns a single album. The albumId will be passed as a parameter in the URL.

app.get("/albums/:albumId", (req, res) => {
  const albumId = req.params.albumId;
 // now find the given album from the `albumsData` using the `albumId`
 // finally send the album you found back to the client
});

πŸ§ͺ Run and test

  1. Save your changes
  2. Make a GET request to http://localhost:3000/albums/10
  3. Try changing the id in the URL and calling the endpoint again. What do you see?

3. POST /albums should save a new album

In order for our server-side to receive and use the data sent by the client, we will need to install and use a middleware.

The JSON middleware makes it easy for our route handlers to read JSON data from the request. If the Content-Type request header indicates that the request body contains JSON data then the middleware calls JSON.parse to convert the request body into a JavaScript data structure.

To register the JSON middleware, add the following to the server code:

app.use(express.json()); // before our routes definition

In server.js, create a POST /albums endpoint that saves a new album. The album will be passed as a JSON object in the request body.

  1. Add the following code to server.js:
app.post("/albums", function (req, res) {
  const newAlbum = req.body;
  albumsData.push(newAlbum);
  res.send("Album added successfully!");
});
  1. Open Postman and create a new request.
  2. Set the Request Type to POST.
  3. Enter the URL for your endpoint, which should be http://localhost:3000/albums.
  4. Set the Body Type to raw and format to JSON (application/json).
  5. Enter the Album Data in the body of the request as JSON:
{
  "albumId": "13",
  "artistName": "BeyoncΓ©",
  "collectionName": "B'Day (Deluxe Edition)",
  "artworkUrl100": "http://is5.mzstatic.com/image/thumb/Music/v4/6c/fc/6a/6cfc6a13-0633-f96b-9d72-cf56774beb4b/source/100x100bb.jpg",
  "releaseDate": "2007-05-29T07:00:00Z",
  "primaryGenreName": "Pop",
  "url": "https://www.youtube.com/embed/RQ9BWndKEgs?rel=0&controls=0&showinfo=0"
}
  1. Click Send.
  2. You should see the album you just created in the response.

4. DELETE /albums/:albumId should delete the album (that matches the passed albumId)

This means that DELETE /albums/2 should delete an album with the id 2 and return 200 with JSON { success: true } to the user.

The code will look like this

// notice .delete
app.delete("/albums/:albumID", function (req, res) {
  console.log("DELETE /albums route");
});

Can you work out how to remove an album using this code?

Acceptance Criteria

  • I have written a server that can handle the following requests:
    • GET /albums
    • GET /albums/:albumId
    • POST /albums
    • DELETE /albums/:albumId
  • I have used Postman to test my server

Resources

Community Lunch

Every Saturday we cook and eat together. We share our food and our stories. We learn about each other and the world. We build community.

This is everyone’s responsibility, so help with what is needed to make this happen, for example, organising the food, setting up the table, washing up, tidying up, etc. You can do something different every week. You don’t need to be constantly responsible for the same task.

Study Group

Learning Objectives

What are we doing now?

You’re going to use this time to work through coursework. Your cohort will collectively self-organise to work through the coursework together in your own way. Sort yourselves into groups that work for you.

Use this time wisely

You will have study time in almost every class day. Don’t waste it. Use it to:

  • work through the coursework
  • ask questions and get unblocked
  • give and receive code review
  • work on your portfolio
  • develop your own projects

πŸ›ŽοΈ Code waiting for review πŸ”—

Below are trainee coursework Pull Requests that need to be reviewed by volunteers.

NW6 | Hadika Malik | Module Servers | Mailing List API project | Week 4 πŸ”—

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR. I have completed the CRUD requests.

Questions

Ask any questions you have for your reviewer.

Start a review
NW6 | Rabia Avci | Module Servers | [TECH ED] Mailing list API Project | Week 4 πŸ”—

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

I created a server, served my app through it. Also created middlewares, routes, utils folders for better documentation.

Questions

Ask any questions you have for your reviewer.

Start a review
WM5 | AISHA_ATHMAN_LALI | MODULE_SERVERS | WEEK_2 | CHAT_SERVER | LEVEL-1-2-3 πŸ”—

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

This is a PR on a chat server project. I have attempted until level 3.

Start a review
NW6 | Fikret Ellek | Module Servers | [TECH ED] 🏝️ Stretch challenges / WEEK 3 πŸ”—

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

I have created enpoints for reviewing, creating and deleting booking data. Tried to separate functions from server file to a specific functions folder.

Questions

Ask any questions you have for your reviewer.

Start a review
WM5| AISHA_ATHMAN_LALI | MODULE_SERVERS | WEEK_1 | QUOTE_SERVER πŸ”—

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

This is a PR for Quote Server API Project.

Start a review
See more pull requests

Afternoon Break

Please feel comfortable and welcome to pray at this time if this is part of your religion.

If you are breastfeeding and would like a private space, please let us know.

Difficult workplace conversations

Learning Objectives

Preparation

Do the prep.

Introduction

Having difficult conversations is part of work life as well and is inevitable. It’s important to know how to have those talks and how to approach people with such topics.

Preparing for a difficult conversation at work

🎯 Goal: To identify the steps to form a constructive response. (30 minutes)

Facilitator to introduce the topic.

Imagine you are at a new job, and one colleague has scheduled to collaborate/meet with you several times and then cancelled at the last minute. You need to meet with this person to take the next steps in the project you are both working on. Use the list below to prepare for your conversation with her. Discuss as a class what you would say to your colleague.

  • What is the key problem to be addressed?
  • What impact does this have on you/the team/work?
  • What responsibility are you going to take for your part?
  • What do you want to achieve by the end of the conversation?

Tip for the facilitator: ensure everyone is invited to talk, especially the quiet ones. If possible, get 2-3 people to answer each question. Make sure to control the time spent on each question to limit it to 5 minutes each and ensure the whole discussion does not exceed 30 minutes.

Preparing for a potentially conflicting situation at work

🎯 Goal: To practice difficult conversations by role-playing through different scenarios. (30 minutes)

Introduce the exercise and read the scenario (5 min)

Pair up and choose a scenario (5 min)

Use one of the below scenarios (per pair) where you need to have a difficult conversation. If you finish your first scenario and still have time, choose another one.

  1. You are a developer in a team, and a very important project has been presented; however, you have not been assigned to it. The person working on this project is a peer who you think isn’t as competent as you. You want to question that decision with your manager.
  2. You are working on a team with a person you have had issues with before. You think they are not doing their share of the work on purpose because they dislike you. You want to talk to this person about it.
  3. You have been working hard and would like to get a pay rise. Have this discussion with your manager.
  4. You think that the project you have been allocated to is impossible and it can’t succeed and you are worried you are being set up to fail. You want to talk to your Product Manager or Product Owner about this.
  5. Someone in your team isn’t doing their share of the work, and you want to talk to them about it.
  6. You have been receiving positive feedback all year, but you didn’t get a promotion. However, your peer did. You want to talk to your manager about it.
  7. You have been working on 3 different projects and you just received an e-mail asking you to support a 4th one and lead a workshop next week. You want to talk to your manager about your workload.
  8. Your company had an internal job opportunity that you applied for. You weren’t the one chosen and never got feedback. So, you arranged a meeting with the interviewer to get feedback on your performance.
  9. You start your new job and 1 month in notice that the tasks you are given do not align with what was on your job description. You want to talk to your manager about it.
  10. You are given a bad performance review. You want to talk to someone in your team to get more information and specific feedback on improving your performance.

Activities:

  • Role-play the conversation as a pair (10 min)
  • List your emotions that you associate with that moment whilst doing the activity
  • Discuss with your partner how that conversation could have been better if you could take the emotion out of it.

Have one group for each scenario to share their thoughts with the class. (10 min)

Tip for the facilitator: Make sure all scenarios are used.

Retro: Start / Stop / Continue

  Retro (20 minutes)</span>