serve

start web server using given routes


Parameters

serve routes :block

Attributes

port:integeruse given port
verboseprint info log
chromeopen in Chrome windows as an app

Returns

  • :nothing

Examples

copy
serve .port:18966 [ GET "/" [ "This is the homepage" ] GET "/post" $[id][ send.html ~"This is the post with id: |id|" ] POST "/getinfo" $[id][ send.json write.json ø #[ i: id msg: "This is some info" ] ] ] ; run the app and go to localhost:18966 - that was it! ; the app will respond to GET requests to "/" or "/post?id=..." ; and also POST requests to "/getinfo" with an 'id' parameter

Related