Skip to main content

Routes

Now that you've installed SpiderWren, it's time to start programming!

warning

If you don't know Wren, read the guide at https://wren.io

First, create a file called index.wren.

This will hold most of your code for now.

Now we need to create some routes.
To create a route, call the Routes.GET(path, handler) function. Routes is found in the web module

index.wren
import "web" for Routes
Routes.GET("/") {
return "Hello, SpiderWren!"
}
note

This won't do anything yet

Next, we actually need to run the app. To do this, we call the App.run(port) function.

index.wren
import "web" for Routes, App
Routes.GET("/") {
return "Hello, SpiderWren!"
}
App.run(3000)

Finally, to run the app, run spiderwren start index.wren on the command line