A set of APIs for handling HTTP and HTTPS requests with Deno 🐿️ 🦕

Overview

oak commons

A set of APIs that are common to HTTP/HTTPS servers.

HTTP Methods (/method.ts)

A set of APIs for dealing with HTTP methods.

Content Negotiation (/negotiation.ts)

A set of APIs for dealing with content negotiation of HTTP requests.

accepts()

Negotiates an acceptable content type based upon the request. The function can be called without any content types and the accepted content types will be returned in priority order as an array of strings, or a set of content types can be passed when calling the function and the best match is returned or undefined if no match is made.

import { accepts } from "https://deno.land/x/oak_commons/negotiation.ts";

declare const req: Request;

// returns acceptable content types in priority order
accepts(req);

// returns the best matching content type of the ones provided
accepts(req, ["text/html", "application/json", "text/plain"]);

acceptsEncoding()

Negotiates an acceptable encoding type based upon the request. The function can be called without any encodings and the accepted content types will be returned in priority order as an array of strings, or a set of encodings can be passed when calling the function and the best match is returned or undefined if no match is made.

You should always supply identity as one of the encodings to ensure that there is a match when the Accept-Encoding header is part of the request.

import { acceptsEncodings } from "https://deno.land/x/oak_commons/negotiation.ts";

declare const req: Request;

// returns acceptable encodings in priority order
acceptsEncodings(req);

// returns the best matching encoding of the ones provided
acceptsEncodings(req, ["gzip", "identity"]);

acceptsLanguages()

Negotiates an acceptable language based upon the request. The function can be called without any languages and the accepted languages will be returned in priority order as an array of strings, or a set of languages can be passed when calling the function and the best language is returned or undefined if no match is made.

import { acceptsLanguages } from "https://deno.land/x/oak_commons/negotiation.ts";

declare const req: Request;

// returns acceptable languages in priority order
acceptsLanguages(req);

// returns the best matching language of the ones provided
acceptsLanguages(req, ["en-gb", "en", "fr"]);

HTTP Status (/status.ts)

An enum, a constant record and a set of guard functions for dealing with HTTP status codes.

You might also like...

Straightforward interactive HTTP requests from within your Alpine.JS markup

Alpine Fetch Straightforward interactive HTTP requests from within your Alpine.JS markup. View the live demo here What does this do? Alpine.JS is a ru

Dec 21, 2022

The Remix version of the fakebooks app demonstrated on https://remix.run. Check out the CRA version: https://github.com/kentcdodds/fakebooks-cra

Remix Fakebooks App This is a (very) simple implementation of the fakebooks mock app demonstrated on remix.run. There is no database, but there is an

Dec 22, 2022

nest연습용 (w. https://github.com/seuiggi, https://github.com/okysky1121)

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Oct 5, 2022

Node.js package with a customized HTTP and HTTPS agents to prevent SSRF with hosts validations and custom DNS feature.

http-agent-dns This is a Node.js package with a customized HTTP and HTTPS agents to prevent SSRF with hosts validations with a possibility to use a cu

Jul 21, 2022

Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks

Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, CloudWatch Alarms and other Route53 HealthChecks

AWS CDK Route53 HealthCheck Create Route53 HealthChecks to monitor TCP, HTTP, HTTPS endpoints, to monitor CloudWatch Alarms and to monitor other Route

Dec 15, 2022

A set of useful helper methods for writing functions to handle Cloudflare Pub/Sub messages (https://developers.cloudflare.com/pub-sub/)

pubsub A set of useful helper methods for writing functions to handle Cloudflare Pub/Sub messages. This includes: A isValidBrokerRequest helper for au

Dec 4, 2022

📡Usagi-http-interaction: A library for interacting with Http Interaction API

📡 - A library for interacting with Http Interaction API (API for receiving interactions.)

Oct 24, 2022

A caching middeware library for Deno HTTP framework, Oak.

A caching middeware library for Deno HTTP framework, Oak.

Caching middleware library for Oak Table of Contents Description Getting Started Middleware and caching Authors License Description Zoic is an easy-to

Sep 28, 2022

This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Dec 3, 2022
Owner
oak
A middleware server for Deno 🦕
oak
🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Denosaurs 26 Dec 10, 2022
A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Jakub Neander 69 Dec 12, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
GraphErr is an open-source error handling library for GraphQL implementations in Deno. It's a lightweight solution that provides developers with descriptive error messages, reducing ambiguity and improving debugging.

GraphErr Descriptive GraphQL error handling for Deno/Oak servers. Features Provides additional context to GraphQL's native error messaging for faster

OSLabs Beta 35 Nov 1, 2022
Zero dependencies, lightweight, and asynchronous https requests package.

This project is a Work in Progress and currently in development. The API is subject to change without warning. A small fetching package for super simp

Ray Arayilakath 11 Dec 8, 2022
nodejs load balancing app to distribute http requests evenly across multiple servers.

load-balancer-nodejs nodejs load balancing app to distribute http requests evenly across multiple servers. How to use ? Please edit the file 'config.j

Abdi Syahputra Harahap 13 Nov 7, 2022
Browser asynchronous http requests

It's AJAX All over again. Includes support for xmlHttpRequest, JSONP, CORS, and CommonJS Promises A. It is also isomorphic allowing you to require('re

Dustin Diaz 2.9k Dec 20, 2022