/throw-me

A url shortener made with nextjs and postgresql database operated with Prisma

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Throw-Me

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

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