Giter VIP home page Giter VIP logo

miniurl's Introduction

miniurl

miniurl is a REST based tinyurl-ish clone.

Adding stuff

To add one do a POST to the root with body;

{
 // id you want to use when getting redirected
 "id": "wtf",  

 // url you want to get redirected to
 "url": "www.google.com", 
 
 // optional. Seconds you want the redirect to be valid for. Will automagically be removed after this has exired.
 "timeout": 10 
}

The result will be '200 OK' if all is well, or '409 Conflict' with body;

{
	"message": "wtf in use"
}

Getting all the stuff

To get of all the urls registered do a GET request to the root. The result will be '200 OK' with a JSON array. Somehting like this;

[
	{
		"id": "one",
		"url": "www.google.com",
		"fetch_count": 1
	},
	{
		"id": "two",
		"url": "www.google.com",
		"fetch_count": 19
	}
]

Removing some stuff

To remove an entry do a DELETE request to the id of the item you want to remove. E.g. DELETE /<id> The result will be either '204 No Content' indicating that the resource was successfully deleted or '404 Not Found' indicating that the resource was not found.

Getting redirected

Do a GET request to the id for the url you want to be redirected to. E.g. GET /<id> The result will be a '302 Found' redirecting the request to the url registerd to the given id, or a '404 Not Found' if the resource was not found.

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.