routes

package
v0.0.0-...-1e66b67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2016 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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 Noop

func Noop(w http.ResponseWriter, req *http.Request)

func Ping

func Ping(w http.ResponseWriter, req *http.Request)

func PublishPackage

func PublishPackage(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)

TODO add authentication middleware

func RendererFromContext

func RendererFromContext(c context.Context) *render.Render

func Root

func Root(w http.ResponseWriter, req *http.Request)

func StorageFromContext

func StorageFromContext(c context.Context) storage.Engine

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL