rest

command
v3.3.3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

REST ==== This example demonstrates a HTTP REST web service with some fixture data. Follow along the example and patterns.

Also check routes.json for the generated docs from passing the -routes flag

Boot the server: ---------------- $ go run main.go

Client requests: ---------------- $ curl http://localhost:3333/ root.

$ curl http://localhost:3333/articles [{"id":"1","title":"Hi"},{"id":"2","title":"sup"}]

$ curl http://localhost:3333/articles/1 {"id":"1","title":"Hi"}

$ curl -X DELETE http://localhost:3333/articles/1 {"id":"1","title":"Hi"}

$ curl http://localhost:3333/articles/1 "Not Found"

$ curl -X POST -d '{"id":"will-be-omitted","title":"awesomeness"}' http://localhost:3333/articles {"id":"97","title":"awesomeness"}

$ curl http://localhost:3333/articles/97 {"id":"97","title":"awesomeness"}

$ curl http://localhost:3333/articles [{"id":"2","title":"sup"},{"id":"97","title":"awesomeness"}]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL