A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.

fix main.rs routes

Changed files
+9 -6
src
+9 -6
src/main.rs
··· 1 1 use actix_cors::Cors; 2 - use actix_files::Files; 3 - use actix_web::{middleware::DefaultHeaders, web, App, HttpServer}; 2 + use actix_web::{web, App, HttpServer}; 4 3 use anyhow::Result; 5 4 use simplelink::{handlers, AppState}; 6 5 use sqlx::postgres::PgPoolOptions; 7 6 use tracing::info; 8 - 9 - async fn index() -> Result<actix_files::NamedFile, actix_web::Error> { 10 - Ok(actix_files::NamedFile::open("./static/index.html")?) 11 - } 12 7 13 8 #[actix_web::main] 14 9 async fn main() -> Result<()> { ··· 53 48 .route("/shorten", web::post().to(handlers::create_short_url)) 54 49 .route("/links", web::get().to(handlers::get_all_links)) 55 50 .route("/links/{id}", web::delete().to(handlers::delete_link)) 51 + .route( 52 + "/links/{id}/clicks", 53 + web::get().to(handlers::get_link_clicks), 54 + ) 55 + .route( 56 + "/links/{id}/sources", 57 + web::get().to(handlers::get_link_sources), 58 + ) 56 59 .route("/auth/register", web::post().to(handlers::register)) 57 60 .route("/auth/login", web::post().to(handlers::login)) 58 61 .route("/health", web::get().to(handlers::health_check)),