Skip to content

etoraghab/throw-me

Repository files navigation

A url shortener (pretty straight forward)

GitHub issues GitHub stars GitHub forks GitHub license

Made with-

  • nextJS
  • prisma
  • postgresql
  • chakra UI

deployed on

  • App on vercel
  • Database on heroku

What Is This?

Now a days, url shorteners are made to launch you to Mars, It doesn't. If you're expecting a url shortener to be elegant accessible, open source, free, ad-less, you're at the right place... This product does exactly what it's said to, not less, not more.

Api

Create the url in the db

Send a post request to https://throw-me.now.sh/api/create/ with body as:

{
  "url": "https://google.com/",
  "name": "google"
}

Create with JavaScript ajax

var url = "https://throw-me.now.sh/api/create/";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
      console.log(xhr.status);
      console.log(xhr.responseText);
   }};

var data = `{
  "url": "https://google.com/",
  "name": "google"
}`;

xhr.send(data);

Get the url from the db

Send a post request to https://throw-me.now.sh/api/get/ with body as:

{
  "name": "theName"
}

Get with JavaScript ajax

var url = "https://throw-me.now.sh/api/get/";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
      console.log(xhr.status);
      console.log(xhr.responseText);
   }};

var data = `{
  "name": "google"
}
`;

xhr.send(data);

Parameters For The Api

  • the url has a limit of 200 characters
  • the name has a limit of 20 characters

Throw-Me - A hassle free URL shortener | Product Hunt throw-me - A hassle free URL shortener. | Product Hunt