11
$\begingroup$

So I was building myself a quick little home page in Mathematica today and I'm hosting it in the Wolfram Cloud because that's a nice easy thing to do. One thing I was wondering about what standard web things the cloud is missing.

I am no web programmer, but one thing I was trying to do a bit ago was generate an HTTP redirect via php and it seemed the cloud didn't support me doing that. Could be I was just setting things up wrong or just misunderstanding how it should work -- as stated, not a web programmer -- but I guess it seems reasonable to me that the cloud wouldn't support php.

What other features is it (or is it at least just likely) missing? More and more I'm interested in doing things with static HTML and stuff, as cloud notebooks are in my experience slower, clunkier, and potentially restricted by my free account. Knowing what I can and cannot do with standard web programming in the Wolfram Cloud will let me better navigate what's worth developing and what isn't.

$\endgroup$
2
  • 5
    $\begingroup$ Better question might be: what isn't it missing $\endgroup$
    – M.R.
    Jun 2 '17 at 16:40
  • $\begingroup$ @M.R. :) alas I don't know enough web-programming to even know where to start, there. I think we can be sure that anything client-side (e.g. CSS, HTML, JavaScript, etc.) will function fine, as it seems to serve static content okay. But can we assume all the server-side stuff like php is missing? $\endgroup$
    – b3m2a1
    Jun 2 '17 at 16:42
4
$\begingroup$

To answer the specific question about HTTP redirects: Use HTTPRedirect, e.g. returned from a Delayed, APIFunction or FormFunction.

In general, you have pretty low-level control over everything via HTTPRequestData and HTTPResponse. Various features such as the ExportForm of an APIFunction are essentially higher-level constructs around that, but you could always fall back to bare-bones HTTP requests and responses if something's missing. Another interesting function might be GenerateHTTPResponse.

It's true that there is no PHP or other server-side "scripting" languages (at least in the "public" Wolfram Cloud; you have more flexibility in a Wolfram Enterprise Private Cloud = EPC). The assumption is that you use the Wolfram Language for server-side programming, i.e. APIFunction & co.

If you're used to templates (from PHP or so), XMLTemplate & co. might be interesting.

You can also host static files on the cloud, e.g. HTML, CSS and JS files. Deploying websites (perhaps with some server-side WL code to make things "live") is certainly one of the main use cases for the Wolfram Cloud. That being said, it's not primarily a file hosting service, so if that's what want (at a large scale), it might be better to use a CDN instead (or in addition).

Another thing you might consider "missing" is direct database access in the public cloud. For now, you can use e.g. ordinary cloud objects, CloudExpression or Data Drop (via DatabinAdd & co.) to persist data in the cloud, or you use some other data persistence service that's exposed via an HTTP API. In EPC, database access is entirely possible.

Regarding notebooks, they are not as fast as pure static HTML, but that gap is becoming smaller thanks to server-side rendering and also the upcoming "static rendering mode", where the notebook is only rendered using the server-generated "HTML cache" and individual cells become interactive as necessary (as opposed to live-rendering everything right away). There will always be some overhead to having a rich notebook interface, but the goal is to keep that overhead to a minimum.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.