diff options
author | 2016-02-21 11:48:45 +0100 | |
---|---|---|
committer | 2016-02-21 11:48:45 +0100 | |
commit | cc24a339d8c0517259084b5c178d784626ba965c (patch) | |
tree | 9868e9687b5802ae0a3733712a3bbeb3bc75c953 /plugins/webserver | |
parent | b5daabda5495dea5c50e17961ecfed2ea8619d76 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Second attempt
Diffstat (limited to 'plugins/webserver')
-rw-r--r-- | plugins/webserver/init.lua | 34 | ||||
-rw-r--r-- | plugins/webserver/plugin.json | 9 |
2 files changed, 43 insertions, 0 deletions
diff --git a/plugins/webserver/init.lua b/plugins/webserver/init.lua new file mode 100644 index 00000000000..3d68b01e6d5 --- /dev/null +++ b/plugins/webserver/init.lua @@ -0,0 +1,34 @@ +local exports = {} +exports.name = "webserver" +exports.version = "1.0.0" +exports.description = "A simple web server" +exports.license = "MIT" +exports.author = { name = "Miodrag Milanovic" } + +local ws = exports + +local app = require('weblit/app') + +function ws.startplugin() + app.bind({ + host = "0.0.0.0", + port = 8080 + }) + + app.use(require('weblit/logger')) + app.use(require('weblit/auto-headers')) + app.use(require('weblit/etag-cache')) + + app.route({ + method = "GET", + path = "/", + }, function (req, res, go) + res.code = 200 + res.headers["Content-Type"] = "text/html" + res.body = "<h1>Hello!</h1>\n" + end) + + app.start() +end + +return exports diff --git a/plugins/webserver/plugin.json b/plugins/webserver/plugin.json new file mode 100644 index 00000000000..e420a5d5485 --- /dev/null +++ b/plugins/webserver/plugin.json @@ -0,0 +1,9 @@ +{ + "plugin": { + "name": "webserver", + "version": "1.0.0", + "author": "Miodrag Milanovic", + "type": "plugin", + "start": "false", + } +}
\ No newline at end of file |