Intensity, highs and lows, and spaghetti - this week had it all!
More complexity layered on what we learnt last week and a sense of building to a 5 -day sprint next week according to our calendar. This meant more files for database seeding, routers, controllers, models, error handling, testing, utilities, etc. It seems like spaghetti code but there is structure there.
There has to be separation of concerns, the alternative is chaos, needle in a haystack time. Finding a typo in 500 lines of code.
I found myself getting disorientated at times: what should I
require here? Do I need to destructure? What is the actual purpose of this function? Think, what is being returned, does it need to be returned? I am SO SLOW!!!
Break, breathe, it is not a race. You are not competing with anyone, except yourself - had to remind myself this a few times this week.
Although I did not finish everything I wanted to, I feel prepared for an extended project to consolidate what I have learned and maybe learn some more - in a word: progress.
- node-postgres to query PostgreSQL data from within an express server.
- Using environment variables to auto-use test or development data.
- Introduction to Supertest to test endpoint responses from a server.
- Node environments and dotenv.
- Using error handling middleware in an express application.
- Identifying PSQL errors and creating custom errors.
- Setting up routes using express.Router()
- Connect to different PostgreSQL databases programmatically.
- Seeding database tables programmatically.
- Manipulating data to conform to database requirements.
- SQL injection and handling it with pg-format.
- Handling optional queries in a request.
- Testing the order of a response body using a particularly excellent npm package.