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

vicanso/elton-fresh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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