From 3a581b17d43dd8d214cd4e739184710471bf4158 Mon Sep 17 00:00:00 2001 From: Kai Vogelgesang Date: Sun, 16 Feb 2020 20:58:08 +0100 Subject: [PATCH] Init --- .gitignore | 103 ++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 12 ++++++ src/main.rs | 20 +++++++++ static/index.html | 10 +++++ 4 files changed, 145 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/main.rs create mode 100644 static/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d8cde6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,103 @@ + +# Created by https://www.gitignore.io/api/rust,clion+all +# Edit at https://www.gitignore.io/?templates=rust,clion+all + +### CLion+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### CLion+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Rust ### +# Generated by Cargo +# will have compiled files and executables +/target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# End of https://www.gitignore.io/api/rust,clion+all diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..20baa29 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "musikbot2" +version = "0.1.0" +authors = ["Kai Vogelgesang "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +actix-web = "2" +actix-files = "0.2.1" +actix-rt = "1" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..0760edb --- /dev/null +++ b/src/main.rs @@ -0,0 +1,20 @@ +use actix_files as fs; +use actix_web::{get, web, App, HttpServer, Responder}; + +#[get("/yeet")] +async fn yeet() -> impl Responder { + println!("yeet!"); + format!("yeet!") +} + +#[actix_rt::main] +async fn main() -> std::io::Result<()> { + HttpServer::new(|| { + App::new() + .service(yeet) + .service(fs::Files::new("/", "static/").index_file("index.html")) + }) + .bind("127.0.0.1:8080")? + .run() + .await +} \ No newline at end of file diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..a7c47a0 --- /dev/null +++ b/static/index.html @@ -0,0 +1,10 @@ + + + + + yeet + + +omg this is working, noice + + \ No newline at end of file