Node you didn’t

A core node module built to handle file i/0, fs, has been the focus of my learning curve these past couple of hours. Up until this point in my life, I had only dealt with sending raw, server-generated data via http using node.

Now I am faced with serving static assets to a client. After sending uninspiring url strings to the clients to show the locations of the assets that the clients were missing out on, my pair partner and I found an answer: a client needs to be hand-fed the data.

Time to debug my mental model of the client-server relationship… so that means, with a RESTful web service, the client cannot directly access any resources on the server that are not explicitly prepared by the server who is hosting those resources.

To tie it all up, readFile is an fs module method we discovered that will parse a file into a data structure that is ready to send on the response object of an HTTP request.

Note: Handling the HTTP response.end method beyond the scope of an asynchronous routine will guarantee that the response object will not wait on the completion of the asynchronous work. A readFile method is an example of one such asynchronous routine.

#growthmindset

#asynchrony

Show your support

Clapping shows how much you appreciated Nick Vinson’s story.