Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (11 sloc) 721 Bytes

Static files

Static files are very easy to be served with Express:

app.get("/:file+", action: StaticAction(path: "public", param:"file"))

The code above tells Express to serve all static files from the public folder recursively (i.e. it will serve both public/article.html as well as public/articles/awesome.html). If you want to serve just the first level in folder, use:

app.get("/:file", action: StaticAction(path: "public", param:"file"))

The difference is just in the pattern: /:file versus /:file+. For more information see our Advanced Routing section.

Next tutorial: Basic error handling

You can’t perform that action at this time.