50 lines
		
	
	
		
			879 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			879 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
:headers = <<
 | 
						|
Content-Type: application/json
 | 
						|
#
 | 
						|
:host = http://localhost:8000
 | 
						|
:api = api/v1
 | 
						|
 | 
						|
# TODO: Check if urls should be singular or plural
 | 
						|
 | 
						|
# Get all urls
 | 
						|
GET :host/:api/urls
 | 
						|
:headers
 | 
						|
 | 
						|
# Get a url
 | 
						|
GET :host/:api/urls/eecd98
 | 
						|
 | 
						|
# TODO: Change to POST
 | 
						|
# Add a url
 | 
						|
PUT :host/:api/urls
 | 
						|
:headers
 | 
						|
{ "username": "Joe" , "url": "https://ferano.io" }
 | 
						|
 | 
						|
# Delete a url
 | 
						|
DELETE :host/:api/urls/4485fe
 | 
						|
 | 
						|
# Redirect
 | 
						|
GET :host/eecd98
 | 
						|
:headers
 | 
						|
 | 
						|
 | 
						|
 | 
						|
###
 | 
						|
# Talk directly to CouchDB
 | 
						|
###
 | 
						|
 | 
						|
# Get value from key
 | 
						|
GET http://admin:password@127.0.0.1:5984/urls/_all_docs?include_docs=true
 | 
						|
:headers
 | 
						|
 | 
						|
# Add a key/value pair
 | 
						|
PUT http://admin:password@127.0.0.1:5984/urls/a28d530a
 | 
						|
:headers
 | 
						|
{ "user_id": "Joe", "full_url": "https://ferano.io" }
 | 
						|
 | 
						|
# Delete a key/value pair
 | 
						|
PUT http://admin:password@127.0.0.1:5984/urls
 | 
						|
:headers
 | 
						|
 | 
						|
# Delete a key/value pair
 | 
						|
DELETE http://admin:password@127.0.0.1:5984/urls
 | 
						|
:headers |