}
dependencies {
- http-server "0.2.24" git="git://onyxlang.io/repo/http-server"
- otmp "0.0.26" git="git://onyxlang.io/repo/otmp"
+ http-server "0.2.24" git="git://repo.onyxlang.io/repo/http-server"
+ otmp "0.0.26" git="git://repo.onyxlang.io/repo/otmp"
+}
+
+build {
+ default {
+ target "out.wasm"
+ runtime "onyx"
+ source "build.onyx"
+ }
+ wasmer {
+ target "wasmer.wasm"
+ runtime "wasi"
+ source "build.onyx"
+ define "WASIX" "CGI_MODE"
+ }
}
#inject runtime.vars {
Enable_Heap_Debug :: true
// Debug :: true
- CGI_MODE :: true
+ // CGI_MODE :: true
}
reg: otmp.TemplateRegistry;
}
main :: () {
+ default_log_level(.Error);
+
reg = otmp.registry();
reg->load_directory("./www/templates", ".html");
}
});
- logger := http.server.logger(style=.V2);
- pipes->pipe(&logger);
#if #defined(runtime.vars.CGI_MODE) {
http.server.cgi(pipes);
} else {
+ logger := http.server.logger(style=.V2);
+ pipes->pipe(&logger);
+
app := http.server.tcp(pipes, .{ thread_count = 8 });
port := conv.parse_int(os.env("SERVER_PORT") ?? "8000");
<p>On Linux, MacOS, or the Windows Subsystem for Linux, run the following commands.</p>
<pre class="hljs"><code class="language-sh"># Clone the Onyx Language Server
git clone https://github.com/onyx-lang/onyx-lsp
-cd onyx-lsp/run_tree
+cd onyx-lsp
# Make the install script executable
-chmod +x ./install
-# Install the LSP
-./install</code></pre>
+chmod +x ./install.sh
+# Install the LSP (compiles and places the WASM file into $ONYX_PATH/tools)
+./install.sh</code></pre>
<h3>Visual Studio Code</h3>
<p>Installing the extension automatically enables the language server in VS Code.</p>