install rust and template
This commit is contained in:
2
qstart/.gitignore
vendored
Normal file
2
qstart/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
target/
|
||||
.spin/
|
16
qstart/Cargo.toml
Normal file
16
qstart/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "qstart"
|
||||
authors = ["HaQadosch <gittea.h0w2x@passmail.net>"]
|
||||
description = "a quick hello world"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = [ "cdylib" ]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
http = "0.2"
|
||||
spin-sdk = { git = "https://github.com/fermyon/spin", tag = "v2.0.1" }
|
||||
|
||||
[workspace]
|
18
qstart/spin.toml
Normal file
18
qstart/spin.toml
Normal file
@ -0,0 +1,18 @@
|
||||
spin_manifest_version = 2
|
||||
|
||||
[application]
|
||||
name = "qstart"
|
||||
version = "0.1.0"
|
||||
authors = ["HaQadosch <gittea.h0w2x@passmail.net>"]
|
||||
description = "a quick hello world"
|
||||
|
||||
[[trigger.http]]
|
||||
route = "/..."
|
||||
component = "qstart"
|
||||
|
||||
[component.qstart]
|
||||
source = "target/wasm32-wasi/release/qstart.wasm"
|
||||
allowed_outbound_hosts = []
|
||||
[component.qstart.build]
|
||||
command = "cargo build --target wasm32-wasi --release"
|
||||
watch = ["src/**/*.rs", "Cargo.toml"]
|
12
qstart/src/lib.rs
Normal file
12
qstart/src/lib.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use spin_sdk::http::{IntoResponse, Request};
|
||||
use spin_sdk::http_component;
|
||||
|
||||
/// A simple Spin HTTP component.
|
||||
#[http_component]
|
||||
fn handle_qstart(req: Request) -> anyhow::Result<impl IntoResponse> {
|
||||
println!("Handling request to {:?}", req.header("spin-full-url"));
|
||||
Ok(http::Response::builder()
|
||||
.status(200)
|
||||
.header("content-type", "text/plain")
|
||||
.body("Hello, Fermyon")?)
|
||||
}
|
Reference in New Issue
Block a user