Search code examples
javascriptnode.jsflatiron.js

How can I serve static files in Node.js with flatiron/director?


flatiron / director is an URL router.

Let's say I have a Node.js application with a public folder including static files like public CSS and JS files. How can I serve everything under this directory using director?


Solution

  • You can use the static plugin for Flatiron to serve static files

    app.use(flatiron.plugins.static, { root: __dirname });