0.0.6 • Published 1 year ago

@bogeychan/elysia-etag v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@bogeychan/elysia-etag

A plugin for Elysia.js for automatic HTTP ETag generation

Installation

bun add @bogeychan/elysia-etag

Usage

import { Elysia } from 'elysia'
import { etag } from '@bogeychan/elysia-etag'

const app = new Elysia()
	.use(etag())
	.get('/', () => 'Checkout the response headers!')
	.get('/custom-etag', (ctx) => {
		// This line disables automatic ETag generation
		// It will still return a 304 - Not Modified - status code if the ETag matches
		ctx.setETag('"myETag"')
		return 'Hello ETag!'
	})
	.listen(8080)

console.log(`Listening on http://${app.server!.hostname}:${app.server!.port}`)

Checkout the examples folder on github for further use cases.

Credits ❤️

This project was inspired by @fastify/etag

Author

bogeychan

License

MIT

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago