Document REST api

This commit is contained in:
James 2018-01-29 21:58:11 +11:00
parent b982383b71
commit d51e0bdb54

View File

@ -114,6 +114,7 @@ impl Service for WebService {
.with_header(ContentType::json()) .with_header(ContentType::json())
.with_body(file) .with_body(file)
} }
// Opens a file dialog and returns the path as a string
(&Get, "/api/file-select") => { (&Get, "/api/file-select") => {
let file_dialog = nfd::open_pick_folder(None).unwrap(); let file_dialog = nfd::open_pick_folder(None).unwrap();
let file = match file_dialog { let file = match file_dialog {
@ -130,6 +131,7 @@ impl Service for WebService {
.with_header(ContentType::json()) .with_header(ContentType::json())
.with_body(file) .with_body(file)
} }
// Returns the default path for a installation
(&Get, "/api/default-path") => { (&Get, "/api/default-path") => {
let path = self.framework.get_default_path(); let path = self.framework.get_default_path();
@ -142,6 +144,7 @@ impl Service for WebService {
.with_header(ContentType::json()) .with_header(ContentType::json())
.with_body(file) .with_body(file)
} }
// Immediately exits the application
(&Get, "/api/exit") => { (&Get, "/api/exit") => {
exit(0); exit(0);
} }