now-x-static v0.0.2
now-x-static
Deploy optimized static Single Page Applications using now
- Static file serving
- Default route is set to
/index.html - Allows to proxy API requests from
/apito your endpoint to avoid CORS complications - Optimized cache headers
- Gzip resources
- Customizable by ejecting the configuration
Install
Globally install:
$ npm install -g now-x-staticUsage
Deploy current folder:
$ now-x-staticDeploy another folder
$ now-x-static ./build_folderDeploy with proxy from /api to api.company.com
$ now-x-static -a `api.company.com`How it works
Since "now" has support for Docker, now-x-static configures an Nginx Dockerfile and deploys it using "now" (You do not need Docker/Nginx installed)
A Dockerfile and default.conf files are copied to your static folder and are removed after the deploy.
Proxy API calls
In order to avoid CORS, now-x-static can set a proxy from /api to an endpoint of your choice:
$ now-x-static -a https://api.company.com Customization
Eject the Dockerfile and default.conf by running
$ now-x-static build_folder -eCustomize the files and use "now" to deploy
$ now --docker build_folderAlternatives
serveusesnodefor static file serving with fallback to index.html
Is this affiliated or endorsed by zeit.co?
No. This is my personal project, built in the spirit of the now eco-system.
Who made this?
Tal Bereznitskey. Find me on Twitter as @ketacode at https://twitter.com/ketacode