Skip to content

Commit fafdabc

Browse files
committed
fix: minimal guide for static assets
1 parent 84377cc commit fafdabc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ with only a subset of sections having recommendations):
5858
* Transactions_handling
5959

6060
* Development
61-
* Static Assets
61+
* [Static Assets](./static-assets.md)
6262
* Keeping up to date
6363
* Code Quality
6464
* [Code Consistency](./code-consistency.md)

static-assets.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Static assets
2+
3+
For serving static resources we recomend using `express.static` middleware.
4+
Using express.static() method, you can server static resources directly by specifying the folder name where you have stored your static resources.
5+
Documentation for the middleware can be found in:
6+
7+
https://expressjs.com/en/starter/static-files.html
8+
9+
## Caching
10+
11+
The static middleware does no server-side caching.
12+
It lets you do two methods of client-side caching: ETag and Max-Age
13+
If you configured your static middleware to use client side caching please make sure that
14+
every modification in your code is represented as different file name.
15+
16+
When using bundlers you will explicitly need to generate different file names every time content changes.
17+
Example for webpack (most popular bundler) can be found here:
18+
19+
https://webpack.js.org/guides/caching

0 commit comments

Comments
 (0)