Giter VIP home page Giter VIP logo

sample-http-app's Introduction

Sample HTTP Application

The sample HTTP application implements the correct shutdown behavior for an HTTP application deployed to Cloud Foundry. It adheres to the following contract when shutting down:

  • App receives termination signal
  • App closes listener so that it stops accepting new connections
  • App finishes serving in-flight requests
  • App closes existing connections as their requests complete
  • App shuts down (or is KILLed)

This application implements the connection management itself in main.go, but similar logic can be found in the Shutdown method of the Golang HTTP server.

Configure

The app is configurable by setting the following environment variables:

  • PORT: The port on which the HTTP server will be listening. It defaults to 8080.

Response Latency

The response latency can be controlled by setting the query parameter wait to any string parseable by time.ParseDuration. The default value is 10 µs.

Deploy to Cloud Foundry

Simply run cf push from the app root directory and it should deploy successfully.

Run Locally

To run locally, follow the steps below:

go get ./...
go build .
./sample-http-app

To run the tests, first get the dependencies using go get -t ./... && go get github.com/onsi/ginkgo/ginkgo then run ginkgo in the app root directory.

sample-http-app's People

Contributors

charlievieth avatar emalm avatar jvshahid avatar flawedmatrix 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.