The backend of a gist server written in Rust
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.rs 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #![feature(proc_macro_hygiene, decl_macro)]
  2. extern crate chrono;
  3. #[macro_use]
  4. extern crate diesel;
  5. extern crate dotenv;
  6. extern crate htmlescape;
  7. extern crate r2d2;
  8. extern crate r2d2_diesel;
  9. #[macro_use]
  10. extern crate rocket;
  11. extern crate rocket_contrib;
  12. #[macro_use]
  13. extern crate serde_derive;
  14. extern crate syntect;
  15. use dotenv::dotenv;
  16. use rocket_contrib::templates::Template;
  17. mod connection;
  18. mod routes;
  19. mod schema;
  20. mod snippet;
  21. use crate::routes::static_rocket_catch_info_for_bad_request;
  22. use crate::routes::static_rocket_route_info_for_create_snippet;
  23. use crate::routes::static_rocket_route_info_for_index;
  24. use crate::routes::static_rocket_route_info_for_show_raw_snippet;
  25. use crate::routes::static_rocket_route_info_for_show_snippet;
  26. fn main() {
  27. dotenv().ok();
  28. rocket::ignite()
  29. .attach(Template::fairing())
  30. .manage(connection::init_pool())
  31. .mount(
  32. "/",
  33. routes![index, show_snippet, show_raw_snippet, create_snippet],
  34. )
  35. .register(catchers![bad_request])
  36. .launch();
  37. }