Documentation ¶
Index ¶
- func CreateMiddleware(handlers ...negroni.HandlerFunc) http.HandlerFunc
- func GetPackageMetadata(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
- func GetTarball(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
- func Login(w http.ResponseWriter, req *http.Request)
- func Noop(w http.ResponseWriter, req *http.Request)
- func Ping(w http.ResponseWriter, req *http.Request)
- func PublishPackage(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
- func RendererFromContext(c context.Context) *render.Render
- func Root(w http.ResponseWriter, req *http.Request)
- func StorageFromContext(c context.Context) storage.Engine
- func ValidateToken(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
- func Whoami(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMiddleware ¶
func CreateMiddleware(handlers ...negroni.HandlerFunc) http.HandlerFunc
CreateMiddleware takes a variable number of negroni.HandlerFuncs and returns a single http.HandlerFunc to pass to gorilla.pat
func GetPackageMetadata ¶
func GetPackageMetadata(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
GetPackageMetadata fetches package meta data
1. fetch package metadata from NPM upstream 2. if 304 -> return 304 and exit 3. if 404 or error -> check storage package 4. if still not found -> 404 5. if all is well, update storage with newer metadata
func GetTarball ¶
func GetTarball(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
GetTarball fetches a tarball from the upstream registry and falls back to storage engine if it fails
func Login ¶
func Login(w http.ResponseWriter, req *http.Request)
Create or verify a user named <username>
func PublishPackage ¶
func PublishPackage(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
TODO add authentication middleware
func ValidateToken ¶
func ValidateToken(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
func Whoami ¶
func Whoami(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
Return the username associated with the NPM token
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.