Automatically serve static files, with version control (etag support), compression and CDN support. This makes it possible to skip all the annoying packaging process when deploying your application.
Automatically serve static files, with version control (etag supported), compression and CDN support. This makes it possible to skip all the annoying packaging process when deploying your application.
You may also want to try a inline static management module.
var express = require'express';var autostatic = require'autostatic';var app = express;var as = autostaticroot: ''dir: __dirname + '/public';appuseasmiddleware;appuseexpressstatic__dirname + '/public';applocalsstatic: ashelper;
this will output as:
abcd.min.js file is generated by this module automatically. This is an asynchronous process, so it will
serve the original
/js/abcd.js first, and cache control is handled by
express.static middleware. Once the
minified version of this file is ready, minified file with etag as suffix (
You can set up a unique domain for your assets (
img.example.com), in Nginx or Apache,
with your public files directory as
root (in Nginx) or
DocumentRoot (in Apache).
Or, set up an
upload method to deploy the compressed file to CDN:
var as = autostaticroot: ''// your upload method;
You can use autostatic to serve multiple static files.
/autostatic can be configured: