GithubHelp home page GithubHelp logo

bogeychan / elysia-etag Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 47 KB

A plugin for Elysia.js for automatic HTTP ETag generation

Home Page: https://npmjs.com/package/@bogeychan/elysia-etag

License: MIT License

TypeScript 100.00%
elysia etag

elysia-etag's Introduction

@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 ${app.server!.url}`)

Checkout the examples folder on github for further use cases.

Credits ❤️

This project was inspired by @fastify/etag

Author

bogeychan

License

MIT

elysia-etag's People

Contributors

bogeychan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.