31Jan

“Module” pattern is usually used to encapsulate some logic inside the component and return only the part that supposed to be public. It brings the encapsulation that’s natively not supported in JavaScript.

Subscribe to our channels!
Youtube
Facebook
Twitter
LinkedIn
Instagram
Google +

We are looking forward to meeting you on our website http://soshace.net

19. Node.js Lessons. Safe Way to a FS File and Path

This article will deal with how to create a web server in Node.js, which will return a file to a user from a public directory. You may wonder: why do we need Node.js here? Why can’t we use another server? You question surely does make sense. Yes, for returning files other servers are generally more effective. From the other side, Node.js works pretty well, too. Second, before returning a file it can also perform some intellectual activities: for example, refer to a database, check out whether a user is permitted to access the file and give the file to him, if it’s permitted.

Leave a Reply