Skip to content

Deploy optimized static Single Page Applications to "now"

Notifications You must be signed in to change notification settings

berzniz/now-x-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 /api to your endpoint to avoid CORS complications
  • Optimized cache headers
  • Gzip resources
  • Customizable by ejecting the configuration

Install

Globally install:

$ npm install -g now-x-static

Usage

Deploy current folder:

$ now-x-static

Deploy another folder

$ now-x-static ./build_folder

Deploy 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 -e

Customize the files and use "now" to deploy

$ now --docker build_folder

Alternatives

  • serve uses node for 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

About

Deploy optimized static Single Page Applications to "now"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published