Skip to content

Smart.js Beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@cpq cpq released this 03 Nov 06:13
· 4133 commits to master since this release

nodejs-compatible HTTP API

Smart.js HTTP API is now compatible with node.js: a subset of node.js's API is implemented. A snippet below demonstrates supported features:

var server = Http.createServer(function(req, res) {
  if (req.uri == '/hello') {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.write(req);
    res.end('\n');
  } else {
    res.serve({ document_root: '/tmp' });
  }
}).listen('127.0.0.1:8000');

var client = Http.request({
  hostname: '127.0.0.1',
  port: 8000,
  path: '/hello',
  method: 'POST',
}, function(res) {
  print('in reply handler', res);
}).end('this is POST data');

Online demo

To demonstrate the abilities of the Smart.js platform, we’ve put together a demo website. It shows a predefined interactive dashboard that allows you to control an IoT device. Demo website link.

Enhancements

  • Networking stack enhancements
  • Memory footprint enhancements
  • Simpler function call API

Using Cesanta Cloud

Cesanta runs a public cloud service at https://cloud.cesanta.com. To login, all you need is a github or G+ account.
Any other cloud service can be used to store data - please use Http API.