slidescript/examples/webserver.ss

26 lines
891 B
Scheme
Executable File

#!/usr/bin/slidescript
# Generate an index.html example for the built-in HTTP daemon example
# This will be used as a disposible web server!
# First, lets populate some data for the web server itself, this script
# will generate the index.html for the web server before launch.
# Variables of the contents for index.html
header=<!DOCTYPE html><html><head><title>SlideScript ~ Web server</title></head>
head=<body><h3>SlideScript - disposible web server index page</h3>
content=<p>There's not much to see here yet, more to come!</p>
footer=<br /><center>powered by ss:http</center></body></html>
# Webserver port
port=8080
# Filename in a variable
filename=index.html
# Writing the variable data to the file
write "%filename%" "%header%%head%%content%%footer%"
# Starting web server in the foreground, change 0 to 1 to fork to background
print "Ctrl-C to kill me!"
nethttp "%port%" "0"