Author: Sheridan

Migrating from MongoDb to PostgreSQL (Case Insensitive Sorting)

After creating a new database in PostgreSQL, I needed to connect my Node/Express application to my database. I decided to use node-postgres to do this. I followed the recommended setup for node-postgres and created a new db folder with an index.js file setting up my PostgreSQL database. After quickly testing to ensure that I was […]

Migrating from MongoDb to PostgreSQL (Database Structure)

As I continued to restructure my database to accommodate user authentication, I ran into several issues. I solved some of these problems using embedded documents and aggregation. However, as I continued to learn more about databases, I came to an important realization: I misunderstood the relationships within the data I created; I incorrectly identified various […]

Using Aggregation to Work With Nested Arrays in MongoDB

After restructuring my database to accommodate user authentication, I was faced with a new challenge: displaying and manipulating information from arrays. Before restructuring the database, I had implemented pagination and a way for users to sort videos and have their sorting preference remembered. The variable videoLimitPerPage established the number of videos a user would see […]

Creating One-to-Many Relationships with Embedded Documents in MongoDB

After adding user authentication, I had three separate schemas for my application: a user schema, a video schema, and a list schema (that referenced videos created using the video schema). After creating an account and logging in, users could see any video or list that any user had created. However, users should have only been […]

Deleting Multiple Documents In One Request With Hidden Form Input

Creating a router and a controller to delete a single video by ID was fairly straightforward. However, this method would give each video its own unique route where a user could then click to delete a video. This sounded pretty tedious, so it was important to me that users could select as many videos as […]

Following URLs with Redirect Requests in Node.js with Follow Redirects

While building out my TikTok app, I encountered a problem that made storing and displaying data difficult: the TikTok API stopped allowing response requests from mobile TikTok links. When using the “Copy Link” function on the native TikTok app, the app produces a shortened URL. For example, TikTok uses this video for their API example: […]