I have solved my biggest challenge for the job board thus far, emailing candidate information to the contact email listed for the job description. That may not seem like a difficult thing to achieve, and it would not be if the form candidates fill out on my site only were text fields. As I have learned over the last few days, when sending data that includes both text and files to the backend, it must be in what is known as "multipart/formdata" format. This format in Node is extremely annoying to work with.
Several NPM packages exist to help parse multipart data, but none of them are intuitive and easy to implement, in fact, most have little documentation and were not made with Next.JS in mind. So parsing multipart data is kind of a nightmare of just trying literally every package and every example on StackOverflow until something works. After several days I was able to get it working using the library "formidable". After that is was just formatting an email with SendGrid and adding the files as attachments. Sounds easy again, but a new issue arose. SendGrid despite being backed by Twilio has very limited documentation. They show how to attach documents but fail to specify the shape of the data that is expected as an attachment. Files can be implemented in a plethora of shapes like say a buffered byte string, or it could be of type blob. So again, I had to just plug and chug until a solution was found. Complaining aside, it works and I am happy with it.
For the small number of people that are keeping up with this series of developer blogs, next up for the job board is reCAPTCHA implementation for security, Stripe integration, polishing a few minor details, making the MVP (minimal viable product) video, then launch. It has now dawned on me that this website might fail, and I am probably going to be very sad if and when it does. For now, I am optimistic and hope that this job board will be a great success!
Top comments (0)