notes for 20200513

let's get a little more systematic with our notes docs now. this will make it a bit easier to turn this into a tutorial some day.

cat coding

So for right now I'll break things down first by bullets of what we did last time and what we should try for this time (and we can load up "next time" with a wish list.)

last time

  1. installed the airtable module with npm i airtable
  2. listed the contents of an airtable table at the /airtable route
  3. learned more about how the files of the express app are linked together
  4. created a simple ejs template that displays json data
  5. learned the very useful JSON.stringify method

we also had an evening session in which we:

  1. added a file to our simple-slack script outside of any folder called cli.js and added a "shebang" to to the top that instructs terminal to run our script from a special launch word we define. The shebang goes at the top of your cli.js file and it looks like:
    #!/usr/bin/env node
  2. added a new element to our package.json document that specifies an executable script's path (./cli.js) and pairs it with an arbitrary word of our choosing that we'll use to launch the script:
    "bin": {
     "my-launch-word": "./cli.js"
    },
  3. back in cli.js we added a console log function to let us know it's working: console.log('it is working');
  4. we then used npm link to install your package globally while in development, making my-launch-word work from anywhere you happen to be in Terminal. Ultimately, when you publish your package to npmjs.com, other people (including future you) will run npm i -g [your_package] to get the same effect.
  5. once all of those steps worked, we then played around with two other fun modules: figlet and chalk to print out a giant title for our little tool. There are many figlet font options, check them out here.
  6. grabbed the same code we used in our Airtable route and ran it from the command line (the sort of thing you might want to do if you wanted to periodically generate some quick text for yourself out of airtable from the command line rather than building a big website or server to do this automatically for any user).

this time

I think maybe the next steps are these:

  1. understand req.params
  2. get and display a specified record at /airtable/:record_id
  3. start to understand JS data types:
    • strings
    • numbers
    • arrays
    • objects
    • booleans
    • dates (which is just an object not its own type, but a special object we'll use a lot)

next time

  1. maybe work on styling this stuff and handling loops in the ejs
  2. maybe catch us all up on using a cli.js file and npm link to create commands? And think about what sorts of commands we might want to build?
  3. maybe work on shell scripting at some point? or using child process to open up stuff in the terminal?
  4. anything else?

notes for and from 20200513