Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node revamp: Using PostgreSQL lesson #27879

Closed

Conversation

fcasibu
Copy link
Contributor

@fcasibu fcasibu commented Apr 28, 2024

Because

To add a new lesson about Using PostgreSQL for the node revamp.

This PR

  • Adds new lesson to nodeJS/express/using_psql.md
  • Copied text from Installing PostgreSQL in the RoR section and intro from our mongodb lesson with just a slight adjustment
  • Disable lint issue for heading (should we fix it here? and maybe open a new PR for the ruby one?)

Issue

Closes #27643

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: NodeJS Involves the NodeJS course label Apr 28, 2024
@fcasibu fcasibu force-pushed the node-revamp/nodejs-using-postgresql branch from a5507c0 to e396a86 Compare April 28, 2024 13:34
@MaoShizhong
Copy link
Contributor

@thatblindgeye I remember you saying something before about how the current way of doing dropdowns isn't fully accessible, and there may be a way to make them so and resolve heading duplication without needing to disable the rules. Is this something that could be actioned on with relative ease in the respective repos? Or is this something more involved that we should disable the rules for now still?

@01zulfi 01zulfi added the Project Node Revamp Issues/PRs related to the Node Revamp project label Apr 29, 2024
@01zulfi 01zulfi self-assigned this Apr 29, 2024
Copy link
Member

@01zulfi 01zulfi left a comment

Choose a reason for hiding this comment

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

@fcasibu 🔥 🔥 great stuff, can't wait to see Postgres stuff out

I have thoughts on how to best teach the lesson content. I presumed that the lesson overview I wrote on the issue would suffice, but after reading the lesson, it needs more "hand-holdiness" i.e. more detailed code-along instructions.

Here's what I propose:

We'll be creating a simple "add user to db" application. Have learners set up a simple express app with the following routes:

  • GET / to display list of all users
  • GET '/new-user` to display form with one "user name" input. this forms sends a request to
  • POST /new-user

Now, we'll instruct to install pg.

Now, we have to create a database, we'll instruct learners to do that in the psql shell:

  • run psql in the cli
  • run create database top_users; in the shell
  • then \l top_users then \c top_users
  • then create table top_users ( ... ) in the shell
  • then the insert query

The shell experience will be invaluable to leaners.

Then set up following files and also provide code. Ask learners to log the functions to see if they get expected data:

  • db/pool.js exports the pool object
  • db/queries.js exports two functions getAllUsers and createUser

Finally, ask learners to use these functions in their controllers.

Once their app is functioning, now we can introduce a "populatedb" script. We'll ask them to delete the database and use this script to setup the db instead of shell.

@01zulfi
Copy link
Member

01zulfi commented May 11, 2024

closed in favor of #27960

@01zulfi 01zulfi closed this May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: NodeJS Involves the NodeJS course Project Node Revamp Issues/PRs related to the Node Revamp project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Lesson: Using PostgreSQL
3 participants