Skip to content

Instantly share code, notes, and snippets.

@andersevenrud
Created August 14, 2016 15:45
Show Gist options
  • Save andersevenrud/9cfae339f095fdbfcee5729179db4ab6 to your computer and use it in GitHub Desktop.
Save andersevenrud/9cfae339f095fdbfcee5729179db4ab6 to your computer and use it in GitHub Desktop.
OS.js Lua HTTP Server Setup
Just quick and dirty instructions on how to run the Lua server on OS.js. Since this runs natively on arduino via build scripts originally -- you have to do some manual wizzardry.
# Files
They are located in the arduino build: https://github.com/os-js/OS.js/tree/arduino/src/server/lua
1. `osjs-api` This is the API endpoint. Place this as `osjs/dist/API`
2. `osjs-fs` This is the VFS endpoint. Place this as `osjs/dist/FS`
3. `osjs.lua` This is the OS.js server script. Place this in `/usr/lib/lua`
4. `session.lua` HTTP Session Library. Place this in `/usr/lib/lua`
# Dependencies
These can be installed via opk
1. `luci` - The 'JSON' library was taken from this package
2. `nixio` - The filesystem abstraction
3. `wsapi` - The HTTP abstraction
4. `uhttpd` - The Webserver
5. `lua` - The Server runtime. You probably also need the CGI package for uhttpd to work
# uhttpd
Set uhttpd to serve from `osjs/dist`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment