Web site hosting?

Hello,

Are you planning on hosting websites to interact with the imp? If not, do you have any recommendations on a host?

Thanks,

-diesel

I tend to spin up Amazon EC2 instances when i need to test something. For new users the micro instances are free for the first year. I’ve been using the Bitnami AMI instances but there are lots of alternatives.

I will check into it, thanks!

  1. Openshift is also free for basic version. Good enough to do much work.
  2. Also I use Google App Engine (GAE) which is free and can server 70k page views per day for free.

I am using GAE since 3 years. Started using OpenShift recently…

AppHarbor (for .net), PagodaBox (for php) and Heroku (for ruby, and js) are what folks around the office like using.

All of these services allow you to push code to a repository hosted on their servers as a means of deploying which is pretty cool.

If you’re looking at a single page type application, you can also just host it out of an agent. Take a look at our SnackBot agent code as an example.

It belongs in my stomach module.

I’m modifying the Snackbot code for my temperature monitor. How would I display a n agent variable in the HTML?

I guess I could have the HTML ask for it…or make a function to pass the variable and then return the HTML? If the HTML is text I guess I could use format string…

That’s how we typically do it (with a format).

So I split up the HTML… can I do something like this?

local html = format(html1 + “%s”, probe1 + html2);

Yeah, that should work. I’ve also done some basic templating code for webpages in Squirrel - it’s not a very complex/complete example (it only returns a 404 page), but it should give you an idea of how you break things apart to build better in-agent webpages.

`page <- @"


%s
%s

";

head <- @"
SportsBall Team Picker 2000



<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<style>.center { text-align: center; margin-left: auto; margin-right: auto; margin-bottom: auto; margin-top: auto; }</style>

";

notFound <- @“


Oops, 404


the page you were looking for could not be found



”;

function renderPage(body) {
return format(page, head, body);
}

http.onrequest(function(req, resp) {
try {
resp.send(404, renderPage(notFound));
} catch (ex) {
resp.send(500, "Internal Server Error: " + ex);
}
});`

Yeah, just realized that it works :slight_smile: Thanks!

Got it working on my thermocouple monitor

I guess I assumed that when you used the string literal that you couldn’t format it?