The roadmap for tomorrow, Thurs Feb 21, contains a line item Practice building an API with ExpressJS/SQL with the lesson as: https://dev.to/achowba/build-a-simple-app-using-node-js-and-mysql-19me
However, today we're having everyone install and play around with PostgreSQL, not MySQL. Rather than have everyone also install MySQL tomorrow, I'd like to have everyone use PostgreSQL. I haven't done the dev.to tutorial myself and don't know if that's easy to do. I'm hoping it's easy to substitute and we can just follow the tutorial, but use Postgres instead of MySQL when it says MySQL.
Does anyone have bandwidth to try it out before the apprentices get to it tomorrow? 馃檹
Items that should be different:
mysql with pg (https://www.npmjs.com/package/pg)CREATE DATABASE socka;
CREATE TABLE IF NOT EXISTS `players` (
`id` SERIAL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`position` varchar(255) NOT NULL,
`number` int(11) NOT NULL,
`image` varchar(255) NOT NULL,
`user_name` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
)
const mysql = require('mysql') becomes const pg = require('pg')mysql.createConnection becomes . const db = new pg.Client({ user: '<user>', host: '<host>', ...etc })
db.connect()
I think pretty much everything else remains the same
Also worth noting that the tutorial doesn't cover installation of postgres or interacting with it via the command line. It pushes that into XAMPP or similar which includes a bundled database and phpmyadmin installation.
PostgreSQL should either be already done or tutorials to cover it should be added as well as using the CLI instead of the UI provided by phpmyadmin.
picked up by risa
Consider: use an entirely different tutorial, such as Treehouse's "Using SQL and Node.js with Sequelize" https://teamtreehouse.com/library/using-sql-and-nodejs-with-sequelize
Why?
Why not use this Sequelize tutorial from Treehouse tomorrow?
I'll decide by the end of the day.
Option three: strike either of those tutorials completely, and instead use the "simple TODO app" in the Integration Testing topic outline beginning here: https://github.com/Techtonica/curriculum/blob/master/testing-and-tdd/integration-testing.md#guided-practice
Why would we do this?
Why not?
Most helpful comment
Items that should be different:
mysqlwithpg(https://www.npmjs.com/package/pg)const mysql = require('mysql')becomesconst pg = require('pg')mysql.createConnectionbecomes .I think pretty much everything else remains the same