Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jig/gosample-httpjsonserver

Bare bones HTTP JSON server (sample code)
https://github.com/jig/gosample-httpjsonserver

Last synced: 6 days ago
JSON representation

Bare bones HTTP JSON server (sample code)

Awesome Lists containing this project

README

        

HTTP server
===========

This is Go (Golang) sample code for a minimal HTTP server. Learning purposes.

jsonserver-raw
--------------

Barebones http json server, it just uses a `switch` based HTTP router.

```
$ ab -v 9 http://localhost:8080/sample1
$ ab -v 9 http://localhost:8080/sample2
```

jsonserver-pkgjson
------------------

Barebones http json server, it just uses a `switch` based HTTP router.
Codifies JSON with `encoding/json` Go package

```
$ ab -v 9 http://localhost:8080/sample1
$ ab -v 9 http://localhost:8080/sample2
```

jsonserver-jsonwithhandler
--------------------------

Uses two server muxes

```
$ ab -v 9 http://localhost:8080/sample/1
$ ab -v 9 http://localhost:8080/sample/2
$ ab -v 9 http://localhost:8080/tmp/hola
```

jsonserver-gocraft
------------------

Uses [gocraft/web](https://github.com/gocraft/web). Sample from its README.md.