I'm starting a new project and I'm trying to figure out what technologies I should use. Here's the deal, I'm writing some software that will run on a wireless router and I would like to provide a web interface. So most likely I will have to do some server-side web development. The only issue is that the device I will be deploying this to only has 16 MB of RAM (Ubiquiti Bullet). Here's some more info:
1.) I'll be using openwrt (linux). 2.) Obviously it has to be lightweight 3.) It's a school project, so I can use any technologies I'd like.
Obviously PHP is the obvious choice, but is there anything else a bit more exciting (I'm not crazy about PHP).
Thanks in advance!
Some of the later versions of OpenWRT come with an interface written entirely in lua (LuCi). Have you checked this out to see if it applies? It runs over standard CGI and is called by the embedded web server that is already running on the OpenWRT (meaning you don't have to add yet another software package).
Check out their website luci.freifunk-halle.net, it apparently is a full featured web framework including MVC, so you are able to get started faster!
PHP is rather big for a router, and I think it won't quite provide the speed that you are looking for! Lua is not a hard scripting language to pick up and start with, it is not that different from PHP, and the Lua website is very good and has loads of documentation!
Consider making a Webmin plugin. Webmin:
It's no silver bullet, but for the niche it serves, it satisfies it 100%. The only downside is that the API, having a long legacy, isn't exactly elegant and you won't win any buzzword awards with it.
The webserver is not the problem. Whatever lightweight httpd options supporting CGI will do the job. And for the content generation I would definitely NOT do it in C. Use the LuCI framework, and design a good interface !
Write it in C.
A light-weight webserver and either built-in modules, or FastCGI. The actual web stuff written in C. You will learn to appreciate higher-level languages and you'll probably use less RAM.
Or, find a nice small http library and embed the http server into your web UI.
I'm in the C camp - go with the smallest server you can find that also allows you to plug in your own API to control the router. Off load as much logic as you can to the browser using javascript to check commands being sent to the back end, and keep yours design to simple form/url handling on the back end.
This link has a list of a number of servers you can look at. Once claims to be only 1k lines of code which is rockin' small http://www.ibm.com/developerworks/web/library/wa-ltwebserv/