O'Reilly logo

Node for Front-End Developers by Garann Means

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Files on the Fly

An in-depth exploration of any of the necessary modules is out of scope for this guide, but there are numerous libraries to help you generate other types of files from within Node. While these aren’t templates in the same sense as the templates we’ve looked at so far, they can map directly to a filename in a URL and be built and served in a way that’s invisible to the user, just like templates. For instance, you might have cause to dynamically generate image files to do resizing or add watermarks. Modules to do that will have their own APIs, and can be loaded and used like any template engine or other module. To keep your application code clean, you’d probably choose to keep the code you write to work with those APIs in a separate file, the same way an external template stores information specific to rendering HTML or other text-based file types.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required