argordmel / throw-me

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

Home Page:https://throw-me.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

https://throw-me.now.sh

License:GNU General Public License v3.0


Languages

Language:JavaScript 83.4%Language:CSS 16.6%