Hosting¶
Warning
These examples won’t run in the playground.
Warning
This is an advanced topic.
You can host a Clio project using clio host
command, you’ll be able to
import the functions you hosted over the network, on server or in the browser.
Let’s define a function and host it:
title = "host-example"
description = ""
version = "0.1.0"
license = "MIT"
main = "src/main.clio"
authors = [ "Your Name <you@example.com>" ]
keywords = ""
[build]
directory = "build"
target = "node"
[target.node]
directory = "src"
target = "node"
[scripts]
test = "No tests specified"
[dependencies]
stdlib = "latest"
[[servers]]
proto = "ws"
port = 1337
host = "0.0.0.0"
name = "default"
[[workers]]
proto = "ws"
url = "ws://localhost:1337"
count = "cpu"
server = "default"
[executor]
proto = "ws"
url = "ws://localhost:1337"
wait_for = "cpu"
server = "default"
Running clio host
in the root directory of the project will host the project.
We can import this in another project:
You can see full examples in our examples repository.