{"id":15779864,"url":"https://github.com/rgl/spin-http-ts-example","last_synced_at":"2025-03-31T15:55:06.010Z","repository":{"id":218217094,"uuid":"745895027","full_name":"rgl/spin-http-ts-example","owner":"rgl","description":"Example Spin HTTP Application written in TypeScript","archived":false,"fork":false,"pushed_at":"2024-11-10T10:25:03.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T11:06:13.893Z","etag":null,"topics":["example","spin","typescript","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-20T13:27:51.000Z","updated_at":"2024-11-10T10:24:50.000Z","dependencies_parsed_at":"2024-01-27T11:54:18.664Z","dependency_job_id":"e293c95a-2ec3-48de-8c9c-d8c454f6ed07","html_url":"https://github.com/rgl/spin-http-ts-example","commit_stats":null,"previous_names":["rgl/spin-http-ts-example"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-ts-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-ts-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-ts-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fspin-http-ts-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/spin-http-ts-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246492393,"owners_count":20786362,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example","spin","typescript","wasm","webassembly"],"created_at":"2024-10-04T18:21:44.008Z","updated_at":"2025-03-31T15:55:05.973Z","avatar_url":"https://github.com/rgl.png","language":"TypeScript","readme":"# About\n\n[![Build status](https://github.com/rgl/spin-http-ts-example/workflows/build/badge.svg)](https://github.com/rgl/spin-http-ts-example/actions?query=workflow%3Abuild)\n\nExample Spin HTTP Application written in TypeScript.\n\n# Usage\n\nInstall [Node.js](https://github.com/nodejs/node) and [Spin](https://github.com/fermyon/spin).\n\nInstall the dependencies:\n\n```bash\nnpm ci\n```\n\nStart the application:\n\n```bash\nspin up --build\n```\n\nAccess the HTTP endpoint:\n\n```bash\nxdg-open http://localhost:3000\n```\n\n# Container Image Usage\n\nThere are two ways to run a WebAssembly binary in a container:\n\n1. Ship the `spin` binary and your `.wasm` file in a container image.\n2. Ship your `.wasm` file and the `spin.toml` manifest/metadata file in a\n   container image; this can be done in a single step with\n   `spin registry push`. Then use a container runtime or orchestrator that\n   supports running wasm containers. For example, `containerd` and the\n   `spin` containerd shim.\n\n**NB** The Fermyon Cloud directly uses the `.wasm` file, so there is no need to\nuse a container. Instead use `spin deploy` to deploy the application to the\nFermyon Cloud.\n\n## Kubernetes Usage\n\nSee https://developer.fermyon.com/spin/v3/kubernetes.\n\n## containerd Usage\n\nInstall [containerd](https://github.com/moby/containerd) and the [containerd-shim-spin](https://github.com/deislabs/containerd-wasm-shims/tree/main/containerd-shim-spin).\n\n### containerd crictl Usage\n\nUse `crictl`:\n\n```bash\n# see https://kubernetes.io/docs/concepts/architecture/cri/\n# see https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/\n# see https://kubernetes.io/docs/reference/tools/map-crictl-dockercli/\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/cmd/crictl/sandbox.go\n# see https://github.com/kubernetes-sigs/cri-tools/blob/master/cmd/crictl/container.go\n# see https://github.com/kubernetes/cri-api/blob/kubernetes-1.27.10/pkg/apis/runtime/v1/api.proto\ncrictl pull \\\n  ghcr.io/rgl/spin-http-ts-example:0.4.0\ncrictl images list\ncrictl info | jq .config.containerd.runtimes\ninstall -d -m 700 /var/log/cri\ncat \u003ecri-spin-http-ts-example.pod.yml \u003c\u003c'EOF'\nmetadata:\n  uid: cri-spin-http-ts-example\n  name: cri-spin-http-ts-example\n  namespace: default\nlog_directory: /var/log/cri/cri-spin-http-ts-example\nEOF\ncat \u003ecri-spin-http-ts-example.web.ctr.yml \u003c\u003c'EOF'\nmetadata:\n  name: web\nimage:\n  image: ghcr.io/rgl/spin-http-ts-example:0.4.0\ncommand:\n  - /\nlog_path: web.log\nEOF\npod_id=\"$(crictl runp \\\n  --runtime spin \\\n  cri-spin-http-ts-example.pod.yml)\"\nweb_ctr_id=\"$(crictl create \\\n  $pod_id \\\n  cri-spin-http-ts-example.web.ctr.yml \\\n  cri-spin-http-ts-example.pod.yml)\"\ncrictl start $web_ctr_id\nweb_ctr_ip=\"$(crictl inspectp $pod_id | jq -r .status.network.ip)\"\nwget -qO- \"http://$web_ctr_ip\"\ncrictl ps -a                    # list containers.\ncrictl inspect $web_ctr_id | jq # inspect container.\ncrictl logs $web_ctr_id         # dump container logs.\ncrictl pods                     # list pods.\ncrictl inspectp $pod_id | jq    # inspect pod.\ncrictl stopp $pod_id            # stop pod.\ncrictl rmp $pod_id              # remove pod.\nrm -rf /var/log/cri/cri-spin-http-ts-example\n```\n\n### containerd ctr Usage\n\n**NB** This is not yet working. See https://github.com/deislabs/containerd-wasm-shims/issues/202.\n\nUse `ctr`:\n\n```bash\nctr image pull \\\n  ghcr.io/rgl/spin-http-ts-example:0.4.0\nctr images list\nctr run \\\n  --detach \\\n  --runtime io.containerd.spin.v2 \\\n  --net-host \\\n  ghcr.io/rgl/spin-http-ts-example:0.4.0 \\\n  ctr-spin-http-ts-example\nctr sandboxes list # aka pods.\nctr containers list\nctr container rm ctr-spin-http-ts-example\n```\n\n# References\n\n* [Spin JS/TS SDK](https://github.com/fermyon/spin-js-sdk)\n* [Spin JS/TS SDK Examples](https://github.com/fermyon/spin-js-sdk/tree/main/examples)\n* [Spin JS/TS @fermyon/spin-sdk NPM package](https://www.npmjs.com/package/@fermyon/spin-sdk)\n* [Building Spin Components in JavaScript](https://developer.fermyon.com/spin/v3/javascript-components)\n* [Done icon](https://icons8.com/icon/uw-X2j32n7Xp/done)\n* [Creating a container image](https://github.com/deislabs/containerd-wasm-shims/blob/main/containerd-shim-spin/quickstart.md#creating-a-container-image)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fspin-http-ts-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fspin-http-ts-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fspin-http-ts-example/lists"}