Taylor Dev Diary - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki
5/21
I've been working on Hw1, Hw2 and Hw6 for a few days now. I've mainly used the API Design with Node.js course.
It wasn't too much of a challenge going from the starting section up to authentication. Prisma comes pretty intuitively to me and so the schema was easy to understand. The database setup was straightforward though I was having some trouble getting npc prisma studio to work on Safari.
Turns out I just have to run it in Firefox and it works. So I guess it's not supported in Safari?
But the biggest challenge was when starting to implement the JWT tokens. I have only a little bit of experience with TypeScript and so I got some compile errors about not having tsc properly installed.
At first I thought I probably forgot the obvious sigh
npm install typescript ts-node @types/node --save-dev
But that didn't fix it so I went back and converted my ES6 syntax to commonJS and got the API REST working in regular JS.
While I did get the REST server working a bit later, it was after starting on authentication I started getting this run error:
api/node_modules/express/lib/router/route.js:216
throw new Error(msg);
I tried looking into my node modules for the express library which I'd npm installed. But when looking for the route.js module to investigate for the error there was no module under 'router' with that name, I also tried to cd into it in case my UI was just hiding it but with no luck.
I went back to my code and checked for any syntax errors but nothing obviously related to the routes.
I was confused and despite trying to find a solution online, I realized though and Paul made a good note that it was probably something wrong with my express so I decided to just go back to the part for installing dependencies and made sure my installs were clear. I also would ensure I had my typescript installs working so I could follow along better. So I just copied my own code as I went along and made sure I wasn't doing something out of order and that worked.
I also double checked with this tutorial here from the assignment page How To Build a REST API with Prisma and PostgreSQL to make sure I wasn't missing a step.
I ended up understanding section 5 better and got my JWT token authentication setup and got user creation and login done today.