Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Like vercel/serve but for production. Serve SPA apps quickly.

License

NotificationsYou must be signed in to change notification settings

numtide/serve-go

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).

Usage

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)

Content Encoding

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.

Example

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

Stars

Watchers

Forks

Packages

 
 
 

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp