π§π½βπ€βπ§π½ 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.
- Traffic Jam: re-order the cars to unblock yourself
- Telephone: draw the words and write the pictures
- 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 π
CRUD 101
Learning Objectives
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:
GET /albums should return all the albums
GET /albums/:albumId should return a single album (that matches the passed albumId)
POST /albums should save a new album
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
npm run dev
- Open Postman
- 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
- Save your changes
- Make a GET request to
http://localhost:3000/albums/10
- 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.
- 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!");
});
- Open Postman and create a new request.
- Set the Request Type to POST.
- Enter the URL for your endpoint, which should be http://localhost:3000/albums.
- Set the Body Type to raw and format to JSON (application/json).
- 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"
}
- Click Send.
- 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 reviewNW6 | 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 reviewWM5 | 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 reviewNW6 | 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 reviewWM5| 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 reviewAfternoon 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
π€π½ FeedbackLearning Objectives
Preparation
Introduction
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.
- 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.
- 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.
- You have been working hard and would like to get a pay rise. Have this discussion with your manager.
- 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.
- Someone in your team isnβt doing their share of the work, and you want to talk to them about it.
- 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.
- 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.
- 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.
- 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.
- 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
activity</span>