Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Latest commit

 

History

History
37 lines (26 loc) · 731 Bytes

README.md

File metadata and controls

37 lines (26 loc) · 731 Bytes

elton-fresh

The middleware has been archived, please use the middleware of elton.

Build Status

HTTP response freshness testing middleware for elton.

package main

import (
	"bytes"

	"github.com/vicanso/elton"

	etag "github.com/vicanso/elton-etag"
	fresh "github.com/vicanso/elton-fresh"
)

func main() {

	e := elton.New()
	e.Use(fresh.NewDefault())
	e.Use(etag.NewDefault())

	e.GET("/", func(c *elton.Context) (err error) {
		c.BodyBuffer = bytes.NewBufferString("abcd")
		return
	})

	err := e.ListenAndServe(":3000")
	if err != nil {
		panic(err)
	}
}