Friday 21 September 2018

Best way to append to a file on every request in a Node app?

I am working on a Node app that uses Express to handle requests. I have a file I want to append a line to for each request, and eventually this file gets sent off to do some batch processing. Yes, kind of like a log file.I don't have a great grasp of how exactly Node handles each request. If I simply call appendFile in the express route handler, will that cause the file to get corrupted? I assume I don't want to do appendFileSync because then the request handler will block, right?

Submitted September 21, 2018 at 09:25PM by The_Talisman

No comments:

Post a Comment