File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
## Static assets
2
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:
3
+ ## Recommended packages
4
+
5
+ * [ express-static] ( https://expressjs.com/en/starter/static-files.html ) .
6
+ Express static is part of the express.js package that allows evelopers to expose static middlewares.
7
+
8
+ ## Guidance
6
9
10
+ For serving static resources we recomend using ` express.static ` middleware as it has been widely used and tested in production.
11
+ When using express.static() method, we can server static resources directly by specifying the folder name where we have stored our static resources.
12
+
13
+ Documentation for the middleware can be found in:
7
14
https://expressjs.com/en/starter/static-files.html
8
15
9
- ## Caching
16
+ ### Caching
10
17
11
- The static middleware does no server-side caching.
18
+ The static middleware does server-side caching.
12
19
It lets you do two methods of client-side caching: ETag and Max-Age
13
20
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.
21
+ every modification in your code will be creating resources with different file name.
15
22
16
23
When using bundlers you will explicitly need to generate different file names every time content changes.
17
24
Example for webpack (most popular bundler) can be found here:
You can’t perform that action at this time.
0 commit comments