fermyon / spin-js-sdk

https://developer.fermyon.com/spin/javascript-components
Apache License 2.0
49 stars 17 forks source link

Spin JS SDK

This is an SDK for Javascript and Typescript based on ComponentizeJS.

Note that this SDK supersedes an earlier, experimental version, which may be found in the sdk-v1 branch.

API Documentation

Installing the templates

Spin is a prerequisite.

The templates can be installed with the following command:

spin templates install --update --git https://github.com/fermyon/spin-js-sdk 

Creating and building a new app

Create a new app from the template installed in the previous step:

spin new -t http-ts hello-world -a

Change directory into the app:

cd hello-world

Install the dependencies and build the app:

npm install
spin buiild

Running the app

spin up

Finally, you can test your app using e.g. curl in another terminal:

curl -i http://127.0.0.1:3000

If all goes well, you should see something like:

HTTP/1.1 200 OK
content-type: text/plain
content-length: 18
date: Thu, 11 Apr 2024 17:42:31 GMT

Hello from Python!

Please file an issue if you have any trouble.

See the examples directory in the repository for more examples.

To learn more about the JS SDK checkout the documentation