chore: import upstream snapshot with attribution
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
pub fn main(world: World) -> Void raises {
|
||||
check std.http.listen(world)
|
||||
}
|
||||
|
||||
fn handle(request: Span<u8>, response: MutSpan<u8>) -> Maybe<Span<u8>> {
|
||||
if std.http.requestIsGet(request, "/ping") {
|
||||
return std.http.writeJsonOk(response, "{\"message\":\"pong\"}")
|
||||
}
|
||||
if std.http.requestIsGet(request, "/health") {
|
||||
return std.http.writeJsonOk(response, "{\"ok\":true}")
|
||||
}
|
||||
if std.http.requestIsPost(request, "/echo") {
|
||||
let body: Maybe<Span<u8>> = std.http.requestJsonBodyWithin(request, 128)
|
||||
if body.has {
|
||||
return std.http.writeJsonCreated(response, body.value)
|
||||
}
|
||||
return std.http.writeJsonBadRequest(response, "{\"error\":\"bad_request\"}")
|
||||
}
|
||||
return std.http.writeJsonNotFound(response, "{\"error\":\"not_found\"}")
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "ping-pong-api"
|
||||
version = "0.1.0"
|
||||
license = "MIT"
|
||||
|
||||
[targets.cli]
|
||||
kind = "exe"
|
||||
main = "src/main.0"
|
||||
defaultTarget = "linux-musl-x64"
|
||||
devTarget = "host"
|
||||
releaseProfile = "release-small"
|
||||
|
||||
[deps]
|
||||
|
||||
[profiles.dev]
|
||||
inherits = "dev"
|
||||
|
||||
[profiles.release-small]
|
||||
inherits = "release-small"
|
||||
Reference in New Issue
Block a user