Skip to content

pedromarquetti/tiny-link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to my link shortener server written in Rust

A simple server that recieves a long url as parameter and returns a tiny-url (that can be expanded).

Built originally with hyper, now using warp to handle HTTP requests and diesel to interact with psql.

Features

  1. Link SHORTENER, duh, it'll save the long-link alongside an unique ID that can be accessed by going to the ID's path like: http(s)://<server link>/<short-link-id>
  2. HTTP validator (will only accept HTTP(s) links).
  3. User Auth/Register/Login using JWT tokens.

How it looks?

The server sends JSON with the containing error message: error msg Or the success link id + a hyperlink: success msg

Running the server locally

Docker

This server is meant to be run as a docker container.

There's a Docker-compose file that can be run with docker-compose up

Cargo

You can also do RUST_LOG="info" cargo run

Links I used to learn

Idea from here

Setting up Diesel - with .env

Basic psql setup on ubuntu

URL Parsing - implemented in parser.rs

TODOS

I'll add here some ideas I'm having for this project.

  1. Implement a function that checks for duplicated short URLs >I used unique PSQL fields for this
  2. Create separate function for the random key generator
  3. Add functionality to users
    1. maybe enable users to create custom IDs?
    2. Make anon. links time-limited, and making user links infinite?
    3. Public/private links?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •