Skip to main content
100%

access jade for multiple files

✓ Published0🌍 Public
Aalex-milanov
Last edited Mar 20, 2015
Created on Mar 20, 2015

This example demonstrates a dynamic server-side route that renders Jade template files based on URL parameters. It uses Express’s `app.get` method with a `:fileName` parameter, and Node.js’s `fs.existsSync` to check whether a corresponding `.jade` file exists in the `views` directory. If the file is present, it calls `res.render` to serve the template; otherwise, it passes control to the next middleware via `next()`. The code shows a file-system-driven routing pattern, where the request path directly maps to template filenames.

AI-generated description

Similar vizzes