Giter VIP home page Giter VIP logo

goecho's Introduction

goecho

Just a simple Go server that echoes the data sent to it.

Installation

You're going to need dep for this project. Clone the repository and run dep ensure. If you don't have your Go path set up, keep reading.

Running

You can run this project solely through Docker. The included Dockerfile is set up to pull down the dependencies, build the project and then create an image out of just the executable.

Run docker build -t goecho . to get an image built and then run docker run -it --name <some_name> -p 8080:80 goecho to get the server started. The container itself exposes port 80.

API

GET /

This is the standard hello world response just to check that the server is running.

GET /get

This is the first of the two echo endpoints on the server. This will echo back any query parameters sent to the server in the response. For example,

For the query

curl http://localhost:8080/get?foo=bar&baz=bat

The server will return

{
    "status": "ok",
    "queryParams": {
        "foo": "bar",
        "baz": "bat"
    }
}

POST /post

The second endpoint echoes the body of the POST request back in the response. For example,

For the query

curl -X POST -d '{ "foo": "bar", "baz": "bat" }' http://localhost:8080/post

The server will return

{
    "status": "ok",
    "body": {
        "foo": "bar",
        "baz": "bat"
    }
}

For this endpoint, the server only supports strings as values, anything else will lead to unintended behavior.

Resources

goecho's People

Contributors

yashdalfthegray avatar keblodev avatar

Watchers

 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.