Skip to content

Conversation

@adamblanchard
Copy link
Contributor

@adamblanchard adamblanchard commented May 15, 2025

Alrighty, here i've tried my best to restructure the content based on the proposal here.

Things I've changed compared to the legacy content:

  1. I added "CRUD vs REST" learning goal, to make sure trainees leave with a really clear understanding (i.e. that REST is the interface and CRUD is the data operation).
  2. I did NOT copy over the phone book code inspiration . Since we already have the simple webserver example and exercises, i think it makes sense to stick with those (and tweak them) since we only have one session.
  3. I increased the scope of "simple server" learning goal to include all get, post, put delete. They should still be simple examples.

Other things we should change/that I need help with:

  1. We need a new assignment. The old ones are a mix of meal-sharing, and sql injection, both of which are out of scope of the learning goals here. I have some suggestions, that are not strongly held:

    1. Add some further, basic, endpoints to the simple web server they created in session
    2. Practice using Postman to create working requests for a public api (increasing in complexity)
  2. Should we leave knex out here? Since in backend we are introducing sqllite, is there a simpler library/skeleton we can offer for now? And introduce knex in backend specialism as an optimisation?

  3. All of these learning goals are copied over from legacy node.js. I do think they are all relevant for foundation, but we really need clear notes/guidance for the lesson plan on how much detail to go into (e.g. this is about concepts, usage and a little bit of coding practice). I suggest for example not going deep into discussing express or knex, but mentioning what they are and why we are using them (literally a few sentences). If people agree, I can write some notes for the lesson plan, but need someone else to help with "simplifying" the code examples/exercises if necessary.

  4. Saying that, I'm considering removing two learning goals:

    1. Tests - these don't seem to show up in any of the material or exercises, and if we want to introduce testing, this seems like the wrong place
    2. Modules - from the perspective of "providing more skeleton code" in foundation, is it appropriate to introduce here? Here is the live coding from legacy, that i am suggesting we don't cover here.

I'm tagging some people who I think are somehow related to the above decisions :D @ahmagdy @marcorichetta @markitosha - please help with feedback if you can 🙏

@adamblanchard adamblanchard marked this pull request as ready for review May 15, 2025 12:22
@adamblanchard adamblanchard requested a review from a team as a code owner May 15, 2025 12:22
@adamblanchard adamblanchard self-assigned this May 15, 2025
Make sure you have `"type": "module"` in your `package.json`.
Do you see `express` somewhere in `package.json`?
Make sure you see the `node_modules` folder.
Also make sure that the `node_modules/` folder is ignored by Git.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its better to add .vscode folder to gitignore too

```shell
npm init -y
npm pkg set type="module"
npm install express

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curios why we don't let them use express generator ? its create a good structure for them and they learn to follow best practice

npm install -g express-generator express --no-view

- [Refresh on REST](https://fullstackopen.com/en/part3/node_js_and_express#rest)
- [A basic GET Request](https://fullstackopen.com/en/part3/node_js_and_express#fetching-a-single-resource)
- [A basic DELETE request](https://fullstackopen.com/en/part3/node_js_and_express#deleting-resources)
- [What is POSTMAN and how to install](https://fullstackopen.com/en/part3/node_js_and_express#postman) - Please install this before the session!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s better to cover modern authentication systems—such as OAuth2, JWT, etc.—and how to use them in Postman here in the document.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than what?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean when we introduce them the postman, then on a small hint or just a short video, tell them there is a part on postman that we can set the authorization ( if endpoint have the authorization), so they will not confused in future,

Copy link
Contributor

@rvedotrc rvedotrc May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. So is your suggestion simply to point out "sometimes you'll need to add authorization details, and this is where it goes" — without necessarily even mentioning OAuth2, JWT, etc. ?

Because if that's what you're suggesting, then I agree, that's sensible.

The phrasing "to cover modern authentication systems—such as OAuth2, JWT, etc." makes me think of something much more complicated, so I just want to check exactly what it is that you're suggesting.

- Much more
- [ ] Simple webserver with node js
- [ ] npm init
- [ ] Tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I believe students should be asked to write tests for every function and endpoint they implement from this point forward. Mentors should also do the same to demonstrate how it works in practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair feedback. Right now we don't cover testing in our existing curriculum. I'm not really sure what this learning goal is about either (see my notes at the top of the pr, I'm planning to remove this) because there is no content in this module about testing either way :D.

This PR is restructuring some of our existing "backend" content into a new "intro to backend" module for the new foundation course. After that, trainees will continue into a frontend course or backend course to further specialise.

So right now, we won't introduce new skills like testing, but it's on the ideas list to explore further soon as a bigger improvement.

@adamblanchard
Copy link
Contributor Author

Thanks for your feedback @reza-faghani! Really appreciate it.

Some of your comments are about improvements to the content, which I'll note for a future task. The scope of this PR is restructuring some of our existing content into this new "intro to backend" module that will exist in our foundation course (see my other comment).

Do you have any additional feedback on those 4 points I wrote in the description? I'm a bit stuck on those before moving this PR forward 🙏

@adamblanchard
Copy link
Contributor Author

Alright, here's my progress on my questions above:

  1. I added a clear placeholder for the assignment, which is missing. I'll create a clear, simple task for this when the rest of the module is clear.
  2. Knex and databases exercise pending input from @marcorichetta
  3. Once 2. is cleared up, i'll flesh out the lesson plan more clearly
  4. I massively simplified the learning goals for module and express. I think we can still use them in the session, but the explanation should be very light. I'm assuming here we should still use express, because it's a lot nicer to write code for and understand. Explanation of express is already planned in backend course, so they can learn more there.

I'm no longer stuck. But if anyone else reviews this PR and has input on the questions/decisions for this module please share.


## Routes

- `/all-users` should respond with all users sorted by ID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find the data that should be stored in the DB in order for this routes to return something.

That makes me thing that if this lesson is about backend:

  1. we can provide a prefilled DB with users table created and sample users. Trainees focus only on backend
  2. Leave the instructions to create the table and add some kind of SQL with several inserts for the trainees to execute in their database. - More complete but also requires tigther setup instructions on the tool used for interacting with the DB.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the last comment #76 (comment), we'll go with 1, to avoid derailing on setup issues.

@marcorichetta
Copy link
Contributor

Alright, here's my progress on my questions above:

1. I added a clear placeholder for the assignment, which is missing. I'll create a clear, simple task for this when the rest of the module is clear.

2. Knex and databases exercise pending input from @marcorichetta

3. Once 2. is cleared up, i'll flesh out the lesson plan more clearly

4. I massively simplified the learning goals for module and express. I think we can still use them in the session, but the explanation should be very light. I'm assuming here we should still use express, because it's a lot nicer to write code for and understand. Explanation of express is already planned in backend course, so they can learn more there.

I'm no longer stuck. But if anyone else reviews this PR and has input on the questions/decisions for this module please share.

Ok, so I just saw (again!) this answer but I already thought about the questions you were stuck with so here's my 2 cents.

  1. Agree with extending the web server they used.
    Also with consuming public APIs. Maybe it's even better because it's a normal every-day task, specially if they're in foundation.

  2. I think we can keep knex. We doesn't need to get deeply technical and it works for just executing raw SQL queries. (Also answering 3)

  3. Tests

  4. Agree. Maybe we can teach them as a masterclass? That idea came out a lot.

  5. Modules - I skimmed the teacher-live-coding repo mentioned there and yeah, it may be a bit too much just for foundation, but interesting for backend specialism.

  • On a side note, I'm thinking on how much modularity can be useful for doing these kind of interchangeable "repos", but that's a different topic.

Copy link
Contributor

@bhas bhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me once we get the exercises defined. Node.js is a bit out of my expert area so I only had limited notes

# Intro to Backend

TODO
Here you can find module content and assignments for the Intro to Frontend module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text says Intro to Frontend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙀 my bad, copying and pasting


- [ ] Introduction to Node.js
- [ ] [What is node and why node?](https://www.youtube.com/watch?v=pU9Q6oiQNd0)
- [ ] V8 vs the browser that runs js?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify this learning goal. I don't understand what it means.

Copy link
Contributor Author

@adamblanchard adamblanchard Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nor me. I feel like v8 is out of scope to reference here in foundation. And a can of worms to start talking about, since v8 is not the only engine around. Feels like it needs way more context to understand properly.

Maybe we should talk simply about how javascript can be run differently (i.e. different environments):

  1. In the browser. Interactivity and fetching data on web pages. Runs in browser engine (chrome, firefox etc.).
  2. On the server (or on your own computer). Building web servers, accessing databases, running scripts etc. Runs in node.

Then i suggest a learning goal to replace this as "Understand the difference between running JavaScript in the browser vs node"

I imagine a simple table with some similarities/differences could be nice to illustrate it.

Do you agree? Can you make it any more simplified/clearer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Bjørn, with v8 as being out of scope and also with the new goal 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Web server
- Much more
- [ ] Simple webserver with node js
- [ ] Simple `GET` requests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple GET requests is quite vague. Is the goal to create the endpoints for it or to just call existing ones?

Is the goal: "Create simple GET endpoints to retrieve data" or should this goal reside under Postman?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the exercises in the "exercises" directory, they should be creating simple Get endpoints to return some simple data (node version, mysql version, and some specific user data from a database).

I don't see any content regarding postman, besides the learning goals. I suggest we also cover POST here. It's already introduced in webarch101, so we should build on it here with actual usage.

I will also add some lesson plan content for setting up postman and showing people how to use it with some example. Then they could follow up with using it for the assignments too (as we discussed further down).

So regarding learning goals, i suggest these tweaks:
Building a simple webserver

  • Creating simple GET endpoints to return data, including from databases
  • ...

Sending requests

  • ...
  • Making GET and POST requests to APIs

I'll update these for now. But please respond if you have a better idea :)

Copy link
Contributor Author

@adamblanchard adamblanchard Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DELETE is also mentioned somewhere (can't find it right now!), and since it's simple we should include that here too for the postman part at least. It's an obvious question too ("ok we added stuff, how do we remove stuff").

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +5 to +8
- [Client server model](https://www.youtube.com/watch?v=L5BlpPU_muY) (6 min)
- [HTTP and HTML](https://www.youtube.com/watch?v=1K64fWX5z4U) (7 min)
- [Video about node](https://www.youtube.com/watch?v=pU9Q6oiQNd0) (13 min)
- [The structure of a web application](https://www.freecodecamp.org/news/how-the-web-works-part-ii-client-server-model-the-structure-of-a-web-application-735b4b6d76e3/) Up until the "That’s all folks! (Well, sorta…)" part
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should anything regarding the client / server be taught here or in web-architecture-101?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in scope of webarch101, so i will remove it here and add it to the webarch101 task for now (in case it's a good resource and we want to include there instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 6 to 7
mkdir nodejs-week1
code nodejs-week1 # to open the folder in VS Code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid relying too much on terminal commands in the foundation unless necessary. Could we just tell the trainees to create a folder and open it via VS code normally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do that. I agree. If someone is already comfortable with the terminal, i guess they will do that naturally anyway.

I'll update these instructions.


Current suggestions (not decided):
1. Add some further basic endpoints to the simple web server they started in the session
2. Practice using Postman to create working requests for some public api (each request increasing in complexity)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a site such as: https://crudcrud.com/ to have the trainees simulate calling a CRUD API. The exercise could require that they hand in some screenshots of the postman requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, that's cool. Sounds good to explore!

@adamblanchard adamblanchard linked an issue Jun 2, 2025 that may be closed by this pull request
@adamblanchard
Copy link
Contributor Author

After reading the comments and thinking more, regarding the exercises, i suggest we de-scope the set up steps and provide the skeleton code in https://github.com/HackYourFuture-CPH/hyf-assignment-template ready for trainees to use.

For example, remove instructions for setting up a new folder, initialising npm, creating app.js file, creating a new database...

We instead provide this directory and files (including sqlite db) in the assignment template as a skeleton app that is already runnable. The session lead could still go through the setup and code a little bit, to provide some familiarity, but focus on the trainees practicing the learning goals rather than lots of things they don't need to know and provide distractions.

I understand that these are exercises in the session (rather than assignments), but i still think it makes sense to set up in the assignment repo, then they also have it ready to extend for a possible assignment to do after the session.

I will go ahead and make these changes so it's easy to review, but @bhas @marcorichetta if you have any thoughts on this in the meantime, let me know! Would appreciate knowing if you think this is the best direction.

@marcorichetta
Copy link
Contributor

LGTM @adamblanchard

About the SQLite DB creation, per my instructions create a DB named hyf_node_week1.sqlite3, I literally meant to create a file, just to clear any doubts. Don't have any problem with providing it in the repo.

I left a question in Slack regarding the use of the https://github.com/HackYourFuture-CPH/hyf-assignment-template, just because I don't understand how/if trainees use it.

@adamblanchard
Copy link
Contributor Author

I shared an example of how I see the skeleton app exercises working (as described above) in this PR HackYourFuture-CPH/hyf-assignment-template#29

If this is apporved, i will make the updates to the exercise readmes in this PR.

@adamblanchard
Copy link
Contributor Author

Phew, ok, I've made the updates to the exercises to remove the setup and mostly let the trainees fill in the gaps to the provided exercises in hyf-assignment-template.

There are stil two todos in this repo, to update the live coding examples (they are too advanced, from legacy nodejs), and to add an assignment. Since this is new content, I will do in a separate task/PR.

@marcorichetta Would you be up to review my final instructions? Check out the "exercises" directory. These now reflect the exercises you previously reviewed in hyf-assignment-template here

Then i'll merge this!

@adamblanchard adamblanchard merged commit feb7190 into main Jul 1, 2025
1 check passed
@rvedotrc rvedotrc deleted the intro-to-backend-module branch October 15, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Create Intro to Backend module

6 participants