/spa-server

Serve single page apps without requiring NPM or whatever crap to be installed on the box

Primary LanguageGoMIT LicenseMIT

Single Page App Server

Minimal server for serving a single-page app

Build

Pointing to the root directory, run:

make

The compiled executable can be found in the build/ directory. Then, to run it:

./build/serve

Deployment

Build for target platform

You can pass in environment variables to compile for a different platform. For example, on a Linux x86 (AWS typically) box:

env GOOS=linux GOARCH=386 make

Copy to target

scp -i path/to/downloaded/ec2/pem path/to/build/serve ec2-user@ec2-ip-addr.compute-1.amazonaws.com:/home/ec2-user/targetdirectory

SSL

This executable integrates simplecert, so certificate generation is automatic. If the -ssl option is enabled, then run:

sudo ./serve -port 443 -rootdir my_app -ssl -domain mysite.com -sslemail email@domain.com -certcache /etc/letsencrypt/live/mysite.com