All Projects → gvolpe → Advanced Http4s

gvolpe / Advanced Http4s

🌈 Code samples of advanced features of Http4s in combination with some features of Fs2 not often seen.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Advanced Http4s

Znetcs.aspnetcore.authentication.basic
A simple basic authentication middleware.
Stars: ✭ 40 (-70.59%)
Mutual labels:  middleware, authentication
Oblecto
Oblecto is a media server, which streams media you already own, and is designed to be at the heart of your entertainment experience. It runs on your home server to index and analyze your media such as Movies and TV Shows and presents them in an interface tailored for your media consupmtion needs.
Stars: ✭ 67 (-50.74%)
Mutual labels:  rest-api, streaming
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-61.76%)
Mutual labels:  middleware, authentication
Scala Pet Store
An implementation of the java pet store using FP techniques in scala
Stars: ✭ 812 (+497.06%)
Mutual labels:  rest-api, typelevel
Resource Router Middleware
🚴 Express REST resources as middleware mountable anywhere
Stars: ✭ 124 (-8.82%)
Mutual labels:  rest-api, middleware
Taliesin
Lightweight audio streaming server
Stars: ✭ 35 (-74.26%)
Mutual labels:  rest-api, streaming
Flask Restful Authentication
An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).
Stars: ✭ 63 (-53.68%)
Mutual labels:  rest-api, authentication
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+254.41%)
Mutual labels:  rest-api, authentication
Auth
Authenticator via oauth2
Stars: ✭ 118 (-13.24%)
Mutual labels:  middleware, authentication
Ngx Api Utils
ngx-api-utils is a lean library of utilities and helpers to quickly integrate any HTTP API (REST, Ajax, and any other) with Angular.
Stars: ✭ 92 (-32.35%)
Mutual labels:  rest-api, authentication
Streamly
Beautiful Streaming, Concurrent and Reactive Composition (Haskell)
Stars: ✭ 553 (+306.62%)
Mutual labels:  concurrency, streaming
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+1327.21%)
Mutual labels:  rest-api, middleware
Swagger Express Middleware
Swagger 2.0 middlware and mocks for Express.js
Stars: ✭ 543 (+299.26%)
Mutual labels:  rest-api, middleware
Go Codon
Workflow based REST framework code generator
Stars: ✭ 133 (-2.21%)
Mutual labels:  rest-api, concurrency
Dj Rest Auth
Authentication for Django Rest Framework
Stars: ✭ 491 (+261.03%)
Mutual labels:  rest-api, authentication
Tigo
Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance. Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。
Stars: ✭ 1,130 (+730.88%)
Mutual labels:  rest-api, middleware
Slim Basic Auth
PSR-7 and PSR-15 HTTP Basic Authentication Middleware
Stars: ✭ 402 (+195.59%)
Mutual labels:  middleware, authentication
Express Openapi Validator
🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
Stars: ✭ 436 (+220.59%)
Mutual labels:  rest-api, middleware
Chi
lightweight, idiomatic and composable router for building Go HTTP services
Stars: ✭ 10,581 (+7680.15%)
Mutual labels:  rest-api, middleware
Pw Pwnage Cfworker
Deploy a Cloudflare Worker to sanely score users' new passwords with zxcvbn AND check for matches against haveibeenpwned's 7.8+ billion breached accounts
Stars: ✭ 125 (-8.09%)
Mutual labels:  rest-api, authentication

advanced-http4s

Code samples of advanced features of Http4s in combination with some features of Fs2 not often seen.

Streaming end to end

  • Server: Streaming responses end to end, from the FileService reading all the directories in your $HOME directory to the FileHttpEndpoint.
  • StreamClient: Parsing chunks of the response body produced by the server in a streaming fashion way.

You'll need two sbt sessions. Run the server in one and after the client in the other to try it out.

Middleware Composition

  • GZip: For compressed responses. Client must set the Accept Encoding header to gzip.
  • AutoSlash: To make endpoints work with and without the slash / at the end.

Response compression is verified by HexNameHttpEndpointSpec. You can also try it out on Postman or similar.

  • Timeout: Handling response timeouts with the given middleware.

The TimeoutHttpEndpoint generates a response in a random time to demonstrate the use.

  • NonStreamResponse: Using the ChunkAggregator middleware to wrap the streaming FileHttpEndpoint and remove the Chunked Transfer Encoding.

The endpoint /v1/nonstream/dirs?depth=3 demonstrates the use case.

Media Type negotiation

  • XML and Json: Decoding request body with either of these types for the same endpoint.

The JsonXmlHttpEndpoint demonstrates this use case and it's validated in its spec.

Multipart Form Data

  • Server: The MultipartHttpEndpoint is responsible for parsing multipart data with the given multipart decoder.
  • MultipartClient: Example uploading both text and an image.

Similar to the streaming example, you'll need to run both Server and MultipartClient to see how it works.

NOTE: Beware of the creation of rick.jpg file in your HOME directory!

Authentication

  • Basic Auth: Using the given middleware as demonstrated by the BasicAuthHttpEndpoint.
  • OAuth 2: Using GitHub as demonstrated by the GitHubHttpEndpoint.

fs2 examples

In the fs2 package you'll find some practical examples of the few things it's possible to build with this powerful streaming library. This might serve as a starting point, your creativity will do the rest.

fs2.async package

Apart from the use of the three core types Stream[F, O], Pipe[F, I, O] and Sink[F, I] you'll find examples of use of the following types:

  • Topic[F, A]
  • Signal[F, A]
  • Queue[F, A]
  • Ref[F, A]
  • Promise[F, A]
  • Semaphore[F]

In addition to the use of some other functions useful in Parallel and Concurrent scenarios.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].