Giter Club home page Giter Club logo

pg-walkthrough's People

Contributors

alice-carr avatar dependabot[bot] avatar eliascodes avatar emilyb7 avatar jsms90 avatar lucyewright avatar m4v15 avatar macintoshhelper avatar marwa7med avatar mattlub avatar shiryz avatar susanx avatar teenie-quaggard avatar tloth avatar zooeymiller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pg-walkthrough's Issues

Unfulfilled learning outcome

In the README:

Running queries in Node

...

  • Using parameterised queries (to prevent SQL injection)

I've looked through the walkthrough steps and there doesn't seem to be anywhere where this learning outcome is fulfilled. Step 3 Part 7 is the only place where the parameterised version of the Client.query command is written, but it's just an aside to the mentor.

I'd suggest either adding an INSERT query at the end of the code-along, or substituting the existing SELECT query for one.

Adding basic skeleton

Me and @shiryz have discussed that it would save time if the static files are ready so there will be more time to focus on the core things of the code along, upon that I am pushing a new branch skeleton which have all necessary files for the server to responses only on the static endpoint/url.

Suggested tidy up in files, various odd hangovers

I've been practicing this code-along in preparation for next week. There's a few odd things about it that I think could do with tidying up/removing.

Minor things:

  • There's a random data.sql file in walkthroughSteps > step-1 > src. It's never referenced in the notes, the only SQL file is db_build.sql. I think it should be removed as it's confusing.
  • the http node module is imported in every handler.js file and never used. Not sure why it's there. I think it should be removed in all 5 steps.
  • Theres a commented out line in step-1 handler.js:
// const getData = require('./dynamic.js');

The uncommented-out version appears in Step 2-4. However in the mentor notes we write this line during Step 5. I suggest we get rid of all references to this until it is brought in in step 5, as it is not relevant until then.

One slightly more major thing but still not that big a deal:

With those changes, the code in Step-1 is identical to that in Step-2. If you look at the walkthough mentor notes, Step 1 is just looking in each file and getting the project running locally. No changes to code occur.

I suggest we rename 'Step-1' in the mentor notes to 'Introduction and Setup' and Step-2 becomes Step-1 and so on so there are actually only 4 steps in the repo instead of 5.

I also suggest that the 'Getting Started' mentor notes be expanded upon. In addition to git cloning, you need to:

$ cd pg-walkthrough/walkthroughSteps/step-1
$ npm install

before npm start will work.

It may help a lesser-prepared mentor in future get started without tripping up.

I would like to address these suggestions and plan on making a PR before next week.

turn this into a code along

Relates https://github.com/foundersandcoders/master-reference/issues/290

@macintoshhelper Have a look at the node intro workshop for inspiration on layout.

You probably want folders like step 1, step 2, etc, which contain the files as they should look after each step of the code along.

This should help:

  • students to go through it again step by step afterwards
  • students who have joined in late and need to catch up
  • yourself to prepare
  • yourself as a fallback in case you make a typo under pressure and can't figure out where it is (last resort)

This is extremely urgent, since this is going to be delivered next week. Please say now if you require help!

(In an ideal world, you might make a video like @oliverjam has done for week 2, so that future mentors / mentors in other campuses could use this to practice.)

file structure is quite confusing

isn't it confusing to tell students to start in step 1 folder and continue working in step 1 folder even when we move on to step 2?

maybe have step 1 as the root, then the other steps in the walkthrough steps folder?

update insecurce dependencies

  • npm is giving a warning about insecure dependencies

  • need to update the dependencies in the package.json (in all steps I guess)

write tests in this code along

One of the big problems during FAC10 was that people didn't understand how to write tests for their database queries.

You can see there are no database tests in most week 6 projects. Only tests for the same things as week 5:

Except this team, who checks whether the response from their getData query is of the right type:

By the end of week 7, their SGC shows:

Go

Travis setup with test database - nobody knows how to do it

There has now been a lot of confusion around testing during the node weeks for FAC11.

  • Add tests to this code along
  • Walk through the Travis set up

The FAC9 research on testing is pretty useful

add author & maintainer to readme

author = @shiryz
Option 1 (maintenance by someone other than the author)

Author

--insert name--
--insert github handle--
--insert photo of author--

Maintainer

--insert name--
--insert github handle--
--insert photo of maintainer--

I was going to use the photos that FAC has of us from day 1 of the course. But obviously people would be free to update it with any photo of themselves that they wanted

Simplify database connection

As I mentioned in this Master Reference issue, the database connection code we've always started students off with is unnecessarily complex.

We can drop almost all the connection string parsing and give it straight to pg:

const { Pool } = require("pg");
require('env2')('./config.env');

const connectionString = process.env.DB_URL;

if (!connectionString) throw new Error("Please set a DB_URL environment variable");

module.exports = new Pool({
  connectionString,
  ssl: !connectionString.includes("localhost")
});

I'm happy to go through all the steps and make the change—it should probably be done for all the workshops this week so the db setup is always consistent.

Move step 4 to step 1

We currently do all our building of files to deal with the database before building a database. The students understand how to create a database and this is an easy step to start with.

Before we have created the database we are referring to this non-existent thing during the current steps (1-3). We are asking the students to imagine something they haven't done and it makes the whole thing harder to grasp.

If we simply create the database at the start and save the 'url' it is very easy to imagine and explain this thing as it actually already exists. It would save a lot of back and forth and the students would do less copying of code in blind faith that it will hopefully make sense later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.