Skip to content

Instantly share code, notes, and snippets.

@kiljacken
Created August 7, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiljacken/866f6617b2998d672ac8f67cb6037186 to your computer and use it in GitHub Desktop.
Save kiljacken/866f6617b2998d672ac8f67cb6037186 to your computer and use it in GitHub Desktop.
#![recursion_limit="256"]
#[macro_use] extern crate warp;
use std::sync::Arc;
use warp::Filter;
type Db = Arc<()>;
fn main() {
let db = Arc::new(());
let db = warp::any().map(move || db.clone());
let f_authenticate = warp::post(
path!("auth" / "token")
.and(db)
.map(authenticate)
);
let f_data_genres = warp::get(
path!("data" / "genres")
.map(data_genres)
);
let f_data_artist_cities = warp::get(
path!("data" / "cities")
.map(data_artist_cities)
);
let f_followed_artist_play_overview = warp::get(
path!("followed" / "overview "/ "play")
.map(followed_artist_play_overview)
);
let f_followed_artist_follower_overview = warp::get(
path!("followed" / "overview" / "follower")
.map(followed_artist_follower_overview)
);
let f_followed_artist_upvote_overview = warp::get(
path!("followed" / "overview" / "upvote")
.map(followed_artist_upvote_overview)
);
let f_followed_artist_plays_graph = warp::post(
path!("followed" / "plays_graph")
.map(followed_artist_plays_graph)
);
let f_followed_artist_upvotes_graph = warp::post(
path!("followed" / "upvotes_graph")
.map(followed_artist_upvotes_graph)
);
let f_followed_artist_overview = warp::get(
path!("followed" / "overview")
.map(followed_artist_overview)
);
let f_trending_lists = warp::get(
path!("trending" / "lists")
.map(trending_lists)
);
let f_genre_stats = warp::post(
path!("listenertrends" / "stats")
.map(genre_stats)
);
let f_trending_genres = warp::get(
path!("listenertrends" / "trending")
.map(trending_genres)
);
let f_genre_plays_graph = warp::post(
path!("listenertrends" / "plays_graph")
.map(genre_plays_graph)
);
let f_search_params = warp::post(
path!("search" / "params")
.map(search_params)
);
let f_advanced_search = warp::post(
path!("search" / "advanced")
.map(advanced_search)
);
let f_dash_overview_stats = warp::get(
path!("dashboard" / String / "overview" / "stats")
.map(dash_overview_stats)
);
let f_dash_overview_tracks = warp::get(
path!("dashboard" / String / "overview" / "tracks")
.map(dash_overview_tracks)
);
let f_dash_overview_collections = warp::get(
path!("dashboard" / String / "overview" / "collections")
.map(dash_overview_collections)
);
let f_dash_overview_plays_graph = warp::get(
path!("dashboard" / String / "overview" / "plays_graph")
.map(dash_overview_plays_graph)
);
let f_dash_overview_followers_graph = warp::get(
path!("dashboard" / String / "overview" / "followers_graph")
.map(dash_overview_followers_graph)
);
let f_dash_overview_related_artists = warp::get(
path!("dashboard" / String / "overview" / "related_artists")
.map(dash_overview_related_artists)
);
let f_dash_overview_age_groups = warp::get(
path!("dashboard" / String / "overview" / "age_groups")
.map(dash_overview_age_groups)
);
let f_dash_overview_map_locations = warp::get(
path!("dashboard" / String / "overview" / "map_locations")
.map(dash_overview_map_locations)
);
let f_dash_track_stats = warp::get(
path!("dashboard" / String / "track" / String / "stats")
.map(dash_track_stats)
);
let f_dash_track_vote_times_graph = warp::get(
path!("dashboard" / String / "track" / String / "vote_times_graph")
.map(dash_track_vote_times_graph)
);
let f_dash_track_plays_graph = warp::get(
path!("dashboard" / String / "track" / String / "plays_graph")
.map(dash_track_plays_graph)
);
let f_dash_track_age_groups = warp::get(
path!("dashboard" / String / "track" / String / "age_groups")
.map(dash_track_age_groups)
);
let f_dash_track_map_locations = warp::get(
path!("dashboard" / String / "track" / String / "map_locations")
.map(dash_track_map_locations)
);
let f_dash_collection_stats = warp::get(
path!("dashboard" / String / "collection" / String / "stats")
.map(dash_collection_stats)
);
let f_dash_collection_tracks = warp::get(
path!("dashboard" / String / "collection" / String / "tracks")
.map(dash_collection_tracks)
);
let f_dash_collection_plays_graph = warp::get(
path!("dashboard" / String / "collection" / String / "plays_graph")
.map(dash_collection_plays_graph)
);
let f_dash_collection_age_groups = warp::get(
path!("dashboard" / String / "collection" / String / "age_groups")
.map(dash_collection_age_groups)
);
let f_dash_collection_map_locations = warp::get(
path!("dashboard" / String / "collection" / String / "map_locations")
.map(dash_collection_map_locations)
);
let routes = f_authenticate
.or(f_data_genres)
.or(f_data_artist_cities)
.or(f_followed_artist_play_overview)
.or(f_followed_artist_follower_overview)
.or(f_followed_artist_upvote_overview)
.or(f_followed_artist_plays_graph)
.or(f_followed_artist_upvotes_graph)
.or(f_followed_artist_overview)
.or(f_trending_lists)
.or(f_genre_stats)
.or(f_trending_genres)
.or(f_genre_plays_graph)
.or(f_search_params)
.or(f_advanced_search)
.or(f_dash_overview_stats)
.or(f_dash_overview_tracks)
.or(f_dash_overview_collections)
.or(f_dash_overview_plays_graph)
.or(f_dash_overview_followers_graph)
.or(f_dash_overview_related_artists)
.or(f_dash_overview_age_groups)
.or(f_dash_overview_map_locations)
.or(f_dash_track_stats)
.or(f_dash_track_vote_times_graph)
.or(f_dash_track_plays_graph)
.or(f_dash_track_age_groups)
.or(f_dash_track_map_locations)
.or(f_dash_collection_stats)
.or(f_dash_collection_tracks)
.or(f_dash_collection_plays_graph)
.or(f_dash_collection_age_groups)
.or(f_dash_collection_map_locations);
warp::serve(routes).run(([127, 0, 0, 1], 3030));
}
fn authenticate(db: Db) -> &'static str {
"ayy lmao"
}
fn data_genres() -> &'static str {
"ayy lmao"
}
fn data_artist_cities() -> &'static str {
"ayy lmao"
}
fn followed_artist_play_overview() -> &'static str {
"ayy lmao"
}
fn followed_artist_follower_overview() -> &'static str {
"ayy lmao"
}
fn followed_artist_upvote_overview() -> &'static str {
"ayy lmao"
}
fn followed_artist_plays_graph() -> &'static str {
"ayy lmao"
}
fn followed_artist_upvotes_graph() -> &'static str {
"ayy lmao"
}
fn followed_artist_overview() -> &'static str {
"ayy lmao"
}
fn trending_lists() -> &'static str {
"ayy lmao"
}
fn genre_stats() -> &'static str {
"ayy lmao"
}
fn trending_genres() -> &'static str {
"ayy lmao"
}
fn genre_plays_graph() -> &'static str {
"ayy lmao"
}
fn search_params() -> &'static str {
"ayy lmao"
}
fn advanced_search() -> &'static str {
"ayy lmao"
}
fn dash_overview_stats(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_tracks(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_collections(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_plays_graph(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_followers_graph(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_related_artists(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_age_groups(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_overview_map_locations(userid: String) -> &'static str {
"ayy lmao"
}
fn dash_track_stats(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_track_vote_times_graph(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_track_plays_graph(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_track_age_groups(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_track_map_locations(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_collection_stats(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_collection_tracks(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_collection_plays_graph(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_collection_age_groups(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
fn dash_collection_map_locations(userid: String, trackid: String) -> &'static str {
"ayy lmao"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment