Finished program

This commit is contained in:
Joshua Higgins
2025-04-08 19:40:11 -04:00
parent aa69268fe2
commit e8954d40bc
6 changed files with 65 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/status-checker.iml" filepath="$PROJECT_DIR$/.idea/status-checker.iml" />
</modules>
</component>
</project>

11
.idea/status-checker.iml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

7
Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "status-checker"
version = "0.1.0"
edition = "2021"
[dependencies]
rocket = "0.5.1"

25
src/main.rs Normal file
View File

@@ -0,0 +1,25 @@
use rocket::http::Status;
use rocket::*;
use std::process::Command;
#[get("/")]
fn index() -> Status {
let result = Command::new("ping")
.args(["8.8.8.8", "-c", "1", "-W", "1"])
.status();
match result {
Ok(stream) => {
match stream.success() {
true => Status::Ok,
false => Status::InternalServerError,
}
}
Err(_) => Status::InternalServerError,
}
}
#[launch]
fn rocket() -> _ {
build().mount("/", routes![index])
}