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.1KB

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