- Notifications
You must be signed in to change notification settings - Fork2
Like vercel/serve but for production. Serve SPA apps quickly.
License
numtide/serve-go
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A mostly drop-in replacement tohttps://www.npmjs.com/package/serve butwritten in Go. For when it's time to go to production.
It's dead simple. Not configurable (happy to get PRs).
It serves all the static files from the current directory. And falls backs toserving theindex.html if the file is not found. Perfect for Single-PageApplications (SPA).
dead-simple application that serves static files from the current directoryUsage: serve-go [options] [<work-dir>]Options: -listen: Port to listen to (default 3000) -oembed-url: Sets the oEmbed Link header if set (env: $SERVEGO_OEMBED_URL) (default ) <work-dir>: Folder to serve (default to current directory)The server now also handles gzip and brotli content-encoding.
For each file that exists in the work directory, it will also look for a .bror .gz file, and if it exists, and the client accepts the encoding, serve thatfile instead of the original one.
Here is how to integrate it in a Docker image:
Dockerfile:
FROM node:15.7.0-alpine3.12 as builderWORKDIR /app/# Install dependenciesCOPY package.json package-lock.json /app/RUN npm install# Build the frontendCOPY . /app/RUN npm run build# Create a serve containerFROM ghcr.io/numtide/serve-go:v1.3.0COPY --from=builder /app/build /site
About
Like vercel/serve but for production. Serve SPA apps quickly.
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.