SQLet: SQL Server Applet.
This is a simple http server for static content, but also run purely SQL scripts to handle request. It is nice to experiment some ideas the quick way by starting a http server in a few seconds, without editing some config file first.
Download from https://github.com/redraiment/sqlet and build by following steps.
git clone https://github.com/redraiment/sqlet.git
cd sqlet
lein uberjar
You need to install leiningen first.
java [options] -jar sqlet-1.0.0-standalone.jar
Run the standalone jar, SQLet will start web server to serve the content of current directory. The default port is 1989. For each request, it will execute every *.sql file, and just return the content of the other files.
For each SQL request, SQLet will launch an anonymous in-memory database, and link to a shared database for application & session scope attributes. The HTTP request will be parsed into below tables:
app
schemaattributes
table: global application scope configurations.name
columnvalue
column
session
schemaattributes
view: session scope attributes.name
columnvalue
column
request
schemacontext
tableremote_address
column: remote ip.server_name
column: server url host name.server_port
column: server port.method
column: request method.scheme
column: http, https.uri
column: path of url.query
column: query of get method.character_encoding
columncontent_type
columncontent_length
columnbody
column: http body string.
headers
tablename
columnvalue
column
cookies
tablename
columnvalue
column
query_params
table: parameters of get method.name
columnvalue
column
form_params
table: parameters of post method.name
columnvalue
column
params
view: union allquery_params
andform_params
.name
columnvalue
column
response
schemacontext
tablecode
column: HTTP response code. 200 default.content_type
column:application/json; charset=utf-8
default.body
column: response body string.
headers
tablename
columnvalue
column
cookies
tablename
column: cookie namevalue
column: the new value of the cookiepath
column: the subpath the cookie is valid fordomain
column: the domain the cookie is valid formax_age
column: the maximum age in seconds of the cookieexpires
column: a date string at which the cookie will expiresecure
column: set to true if the cookie requires HTTPS, prevent HTTP accesshttp_only
column: set to true if the cookie is valid for HTTP and HTTPS only
-Dsqlet.port=<port>
: Listen on port<port>
for incoming connections.
Save below content as index.sql
.
insert into response.content (content_type, body) values ('text/html; charset=utf-8', '<h1>Hello world</h1>');
Then start SQLet server, and visit http://localhost:1989/index.sql .
Copyright © 2018 FIXME
Distributed under the FreeBSD Copyright.