{"id":18539638,"url":"https://github.com/benwhitehead/finch-server","last_synced_at":"2025-04-09T17:38:22.510Z","repository":{"id":20701531,"uuid":"23985229","full_name":"BenWhitehead/finch-server","owner":"BenWhitehead","description":"Some base classes and configuration used for making a server using finch","archived":false,"fork":false,"pushed_at":"2016-07-05T21:10:01.000Z","size":77,"stargazers_count":22,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T09:47:07.026Z","etag":null,"topics":["finagle","finch","http-server","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BenWhitehead.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-13T03:51:49.000Z","updated_at":"2024-03-17T23:00:57.000Z","dependencies_parsed_at":"2022-08-19T19:31:11.364Z","dependency_job_id":null,"html_url":"https://github.com/BenWhitehead/finch-server","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWhitehead%2Ffinch-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWhitehead%2Ffinch-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWhitehead%2Ffinch-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenWhitehead%2Ffinch-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenWhitehead","download_url":"https://codeload.github.com/BenWhitehead/finch-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248078641,"owners_count":21044149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finagle","finch","http-server","scala"],"created_at":"2024-11-06T19:49:20.292Z","updated_at":"2025-04-09T17:38:22.229Z","avatar_url":"https://github.com/BenWhitehead.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"finch-server\n============\n\nFinch Server is a library that merges together the great libraries [finch](https://github.com/finagle/finch), and [twitter-server](https://github.com/twitter/twitter-server).\n\nTwitter 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.\n\n# Features\n\n## Config Flags\n\nAll configurable aspects of a finch-server can be configured with command line flags using twitter-utils [Flag](https://github.com/twitter/util/blob/master/util-app/src/main/scala/com/twitter/app/Flag.scala). The following is a list of flags that are available to configure a finch-server.\n\nThe 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.\n\n```\n-admin.port=:9990                                         : the TCP port for the admin http server\n-io.github.benwhitehead.finch.certificatePath=            : Path to PEM format SSL certificate file\n-io.github.benwhitehead.finch.httpInterface=:7070         : The TCP Interface and port for the http server {[\u003chostname/ip\u003e]:port}. (Set to empty value to disable)\n-io.github.benwhitehead.finch.httpsInterface=             : The TCP Interface and port for the https server {[\u003chostname/ip\u003e]:port}. Requires -io.github.benwhitehead.finch.certificatePath and -io.github.benwhitehead.finch.keyPath to be set. (Set to empty value to disable)\n-io.github.benwhitehead.finch.keyPath=                    : Path to SSL Key file\n-io.github.benwhitehead.finch.maxRequestSize=5            : Max request size (in megabytes)\n-io.github.benwhitehead.finch.pidFile=                    : The file to write the pid of the process into\n-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.\n```\n\n# Filters\n\n## Route Histograms\nFinch 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.\n\n## Access Logging\nFinch-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.\n\n# Admin HTTP Server\nTwitter-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.\n\n# SLF4J Logging\nBy 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.\n\nNo SLF4J Backed is declared as a dependency, so feel free to pick whichever backend you like.  The unit tests however use logback.\n\nAn 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.\n\n# Usage\nfinch-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.\n\n### Server Object\n```scala\nimport io.finch._\nimport io.github.benwhitehead.finch.FinchServer\n\nobject EchoServer extends FinchServer {\n  override lazy val serverName = \"echo\"\n\n  val echo: Endpoint[String] = get(\"echo\" / string) { (phrase: String) =\u003e\n    Ok(phrase)\n  }\n\n  def service = echo.toService\n}\n```\n\nThe Endpoint will be boostrapped with all filters and can service requests. For example:\n```\nGET /echo/Hello+World HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nHost: localhost:17070\nUser-Agent: HTTPie/0.9.0\n\nHTTP/1.1 200 OK\nContent-Length: 11\n\nHello World\n\n```\n\n# Artifacts\n\nCompiled for scala 2.11\n\n## SBT\n\nArtifacts for finch-server are currently hosed in a google storage bucket, so you will need to add a resolver to your sbt config.\n\n```\nresolvers += \"finch-server\" at \"http://storage.googleapis.com/benwhitehead_me/maven/public\"\n\nlibraryDependencies ++= Seq(\n  \"io.github.benwhitehead.finch\" %% \"finch-server\" % \"0.9.1\"\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwhitehead%2Ffinch-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenwhitehead%2Ffinch-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenwhitehead%2Ffinch-server/lists"}