Skip to content

Instantly share code, notes, and snippets.

@modster
Created December 15, 2021 02:09
Show Gist options
  • Save modster/7f7c7bfcef06ff135f043d1fa1060b9a to your computer and use it in GitHub Desktop.
Save modster/7f7c7bfcef06ff135f043d1fa1060b9a to your computer and use it in GitHub Desktop.
RunKit

RunKit

RunKit Endpoint

https://runkit.com/docs/endpoint

exports.endpoint = function(request, response) {
    response.end("Hello world!");
}

curl https://gukz57faao6o.runkit.sh


URLs

Every RunKit Notebook has a main url like:

https://runkit.com/runkit/endpoint-demo-1

as well as specific revision URLs like:

https://runkit.com/runkit/endpoint-demo-1/branches/master https://runkit.com/runkit/endpoint-demo-1/1.0.0

Notebooks access through endpoint are hosted on runkit.io and each user has their own subdomain. Unlike the main notebook page, which has a shorthand for accessing the latest revision, you'll just need to specifically reference /branches/master. Being explicit has an advantage; it means that not only will your notebook respond to urls like:

https://runkit.runkit.io/endpoint-demo-1/branches/master

It also responds to any sub-paths like these:

https://runkit.runkit.io/endpoint-demo-1/branches/master/hello/world https://runkit.runkit.io/endpoint-demo-1/branches/master/use/the/force

You can use the environment variable process.env.RUNKIT_MOUNT_PATH to programatically check the base path of your endpoint, and process.env.RUNKIT_ENDPOINT_URL to get the base URL of your endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment