Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/vanackere/slim

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/vanackere/slim

  • v0.0.0-20141118023030-4d0ef3522d1f
  • Source
  • Go
  • Socket score

Version published
Created
Source

Slim

GoDoc Build Status

Slim is a fork of Goji, a minimalistic web framework that values composability and simplicity.

Differences with Goji

  • Slim opted to implement its request context using "code.google.com/p/go.net/context" (see here for an introduction).
  • Slim middlewares can also be written using the simpler form:
func(ctx context.Context, w http.ResponseWriter, r *http.Request, next web.Handler)

Example

package main

import (
        "fmt"
        "net/http"

        "code.google.com/p/go.net/context"
        "github.com/vanackere/slim"
        "github.com/vanackere/slim/web"
)

func hello(ctx context.Context, w http.ResponseWriter, r *http.Request) {
        p := web.URLParams(ctx)
        fmt.Fprintf(w, "Hello, %s!", p["name"])
}

func main() {
        slim.Get("/hello/:name", hello)
        slim.Serve()
}

Slim also includes a sample application in the example folder which was artificially constructed to show off all of Slim's features. Check it out!

Features

  • Fork of the excellent Goji framework
  • Compatible with net/http
  • URL patterns (both Sinatra style /foo/:bar patterns and regular expressions, as well as custom patterns)
  • Reconfigurable middleware stack
  • Context/environment object threaded through middleware and handlers
  • Context is the one from "code.google.com/p/go.net/context" (see here for an introduction)
  • Automatic support for Einhorn, systemd, and more
  • Graceful shutdown, and zero-downtime graceful reload when combined with Einhorn.

See Goji's README for why Goji's - and therore Slim's ! - approach is good.

FAQs

Package last updated on 18 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc