All Projects → BenWhitehead → finch-server

BenWhitehead / finch-server

Licence: Apache-2.0 license
Some base classes and configuration used for making a server using finch

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to finch-server

finch-demo
Introduction to Finch, a lightweight HTTP server library based on Twitter's Finagle.
Stars: ✭ 19 (-17.39%)
Mutual labels:  http-server, finch
Finch
Scala combinator library for building Finagle HTTP services
Stars: ✭ 1,552 (+6647.83%)
Mutual labels:  finagle, finch
http4s-finagle
Http4s on Finagle Server or Client
Stars: ✭ 12 (-47.83%)
Mutual labels:  finagle
HTTP-Reverse-Shell
An HTTP Reverse Shell in Python
Stars: ✭ 48 (+108.7%)
Mutual labels:  http-server
SQLiteQueryServer
Bulk query SQLite database over the network
Stars: ✭ 48 (+108.7%)
Mutual labels:  http-server
yams
YAMS: Awesome MIPS Server
Stars: ✭ 17 (-26.09%)
Mutual labels:  http-server
vscode-open-in-default-browser
Open In Default Browser
Stars: ✭ 22 (-4.35%)
Mutual labels:  http-server
sheret
A tiny, simple static file web server.
Stars: ✭ 45 (+95.65%)
Mutual labels:  http-server
http-node-api
O objetivo dessa aplicação era criar uma API sem nenhuma dependência externa, apenas utilizando as bibliotecas nativas do NodeJS. Tudo foi feito utilizando 100% Javascript.
Stars: ✭ 44 (+91.3%)
Mutual labels:  http-server
snunit
Scala Native HTTP server based on NGINX Unit
Stars: ✭ 87 (+278.26%)
Mutual labels:  http-server
rawhttp
HTTP library to make it easy to deal with raw HTTP.
Stars: ✭ 156 (+578.26%)
Mutual labels:  http-server
python-simple-http-server
A super light way HTTP server written by python, support websocket and coroutine.
Stars: ✭ 26 (+13.04%)
Mutual labels:  http-server
aqua
A minimal and fast 🏃 web framework for Deno
Stars: ✭ 219 (+852.17%)
Mutual labels:  http-server
fastglue
Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.
Stars: ✭ 71 (+208.7%)
Mutual labels:  http-server
smartacus-mqtt-broker
smartacus-mqtt-broker is a Java-based open source MQTT broker that fully supports MQTT 3.x .Using Netty 4.1.37
Stars: ✭ 25 (+8.7%)
Mutual labels:  http-server
LightWebServer
Java web server using NIO, compatible with http1.1 and support simple MVC function.
Stars: ✭ 38 (+65.22%)
Mutual labels:  http-server
b23.wtf
Remove tracing parameters from b23.tv/*.
Stars: ✭ 85 (+269.57%)
Mutual labels:  http-server
minimal-http-server
Basic http server
Stars: ✭ 26 (+13.04%)
Mutual labels:  http-server
web-benchmarks
A set of HTTP server benchmarks for Golang, node.js and Python with proper CPU utilization and database connection pooling.
Stars: ✭ 22 (-4.35%)
Mutual labels:  http-server
gowebview
tool to build android apps with WebView from your golang http server; moved to gitlab.com/microo8/gowebview
Stars: ✭ 35 (+52.17%)
Mutual labels:  http-server

finch-server

Finch Server is a library that merges together the great libraries finch, and twitter-server.

Twitter has done a great job of providing great features in twitter-server, but there are some subtleties in utilizing these features, this project aims to make it as easy as possible to use finch and twitter-server together.

Features

Config Flags

All configurable aspects of a finch-server can be configured with command line flags using twitter-utils Flag. The following is a list of flags that are available to configure a finch-server.

The motivation behind using flags is that when running applications on Mesos or in the Cloud, having a self contained task is much better than depending on other resource to configure your app (such as properties/config files). By having all configuration take place with command line flags it becomes trivial to run your server on any host.

-admin.port=:9990                                         : the TCP port for the admin http server
-io.github.benwhitehead.finch.certificatePath=            : Path to PEM format SSL certificate file
-io.github.benwhitehead.finch.httpInterface=:7070         : The TCP Interface and port for the http server {[<hostname/ip>]:port}. (Set to empty value to disable)
-io.github.benwhitehead.finch.httpsInterface=             : The TCP Interface and port for the https server {[<hostname/ip>]:port}. Requires -io.github.benwhitehead.finch.certificatePath and -io.github.benwhitehead.finch.keyPath to be set. (Set to empty value to disable)
-io.github.benwhitehead.finch.keyPath=                    : Path to SSL Key file
-io.github.benwhitehead.finch.maxRequestSize=5            : Max request size (in megabytes)
-io.github.benwhitehead.finch.pidFile=                    : The file to write the pid of the process into
-io.github.benwhitehead.finch.accessLog=access-log        : Whether to add an Access Log Filter, and if so which type [off|access-log{default}|access-log-combined]. Any value other than the listed 3 will be treated as off.

Filters

Route Histograms

Finch Proves a great API for declaring route handlers, finch-server adds a filter to the server to record latency and request count per route and report all metrics to the configured StatsReceiver.

Access Logging

Finch-server can weave a filter into the request chain to provide access logging for all requests to the server. Both traditional and combined formats can be chosen from.

Admin HTTP Server

Twitter-server provides a great AdminHttpServer that can be used to gain insight into how your application is performing, or to provide important administrative tasks (like getting a thread dump from a running server through an Http Interface). There can be some nuance to correctly starting the AdminHttpServer so this is done automatically by finch-server.

SLF4J Logging

By default all twitter libraries use Java Util Logging, finch-server has been configured to use SLF4J for all logging and automatically sets up all SLF4J bridges and re-configures Java Util Logging.

No SLF4J Backed is declared as a dependency, so feel free to pick whichever backend you like. The unit tests however use logback.

An example logback.xml for how to configure access-log file and rolling is available in example-logback.xml in the repo or bundled in the jar.

Usage

finch-server is very easy to use, all you need to create an echo server is the following object. With this object you will now have a full server running your application on port 7070 and the Admin Server on 9990.

Server Object

import io.finch._
import io.github.benwhitehead.finch.FinchServer

object EchoServer extends FinchServer {
  override lazy val serverName = "echo"

  val echo: Endpoint[String] = get("echo" / string) { (phrase: String) =>
    Ok(phrase)
  }

  def service = echo.toService
}

The Endpoint will be boostrapped with all filters and can service requests. For example:

GET /echo/Hello+World HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:17070
User-Agent: HTTPie/0.9.0

HTTP/1.1 200 OK
Content-Length: 11

Hello World

Artifacts

Compiled for scala 2.11

SBT

Artifacts for finch-server are currently hosed in a google storage bucket, so you will need to add a resolver to your sbt config.

resolvers += "finch-server" at "http://storage.googleapis.com/benwhitehead_me/maven/public"

libraryDependencies ++= Seq(
  "io.github.benwhitehead.finch" %% "finch-server" % "0.9.1"
)
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].