Welcome to App Engine for JavaScript! With App Engine, you can build web applications using the JavaScript programming language, and take advantage of the many libraries, tools and frameworks for JavaScript that professional developers use to build world-class web applications. Your JavaScript application runs on Google's scalable infrastructure on top of Java and Rhino, and uses large-scale persistent storage and services.
This is a community project, not affiliated in any way with Google.
This SDK is part of the Nitro ecosystem of Web Application development resources. The SDK tracks the latest developments in the CommonJS group.
The SDK is powered by Rhino on top of . However, the API is based on . In our view, the design of the Python API is closer to the JavaScript world.
As a result, a developer can consult the documentation to work effectively with the JavaScript SDK.
We use JavaScript coding conventions. Python names like 'thisisa_name' are converted to JavaScript names like 'thisIsAName'. Moreover all delete() functions are renamed to .remove() functions to avoid collisions with the delete keyword (a DELETE() alias is also provided but it's uses is not recommended and may be deprecated in the future).
The Python ext/db api is supported. The API is slightly different to better fit JavaScript.
var db = require("google/appengine/ext/db");
var Category = db.Model("Category", {
label: new db.StringProperty(),
category: new db.ReferenceProperty({referenceClass: Category})
});
var c = new Category({keyName: "news", label: News"});
c.put();
var key = ...
var c1 = Category.get(key);
var c2 = Category.getByKeyName("news");
var categories = Category.all().limit(3).fetch();
form:
var blobstore = require("google/appengine/api/blobstore");
exports.GET = function(env) {
return {data: {
uploadURL: blobstore.createUploadUrl("/test")
}}
}
<form action="{uploadURL}" method="POST" enctype="multipart/form-data">
<p>
<input type="file" name="file" />
</p>
<p>
<button type="submit">Upload</button>
</p>
</form>
upload:
var blobstore = require("google/appengine/api/blobstore");
exports.GET = function(env) {
return {data: {
uploadURL: blobstore.createUploadUrl("/save")
}}
}
save:
var blobstore = require("google/appengine/api/blobstore");
exports.POST = function(env) {
var blobs = blobstore.getUploadedBlobs(env);
return {
status : 303,
headers : {
"Location": "/serve?key=" + blobs.file.toString()
}
};
}
serve:
var blobstore = require("google/appengine/api/blobstore");
exports.GET = function(env) {
var params = new Request(env).GET();
return blobstore.serve(params.key, env);
}
var fetch = require("google/appengine/api/urlfetch").fetch;
var response = fetch("https://appenginejs.org"),
html = response.content.decodeToString("UTF-8");
var images = require("google/appengine/api/images");
var i = images.resize(params.image.data, 640, 480);
var EmailMessage = require("google/appengine/api/mail").EmailMessage;
new EmailMessage({
sender: "[email protected]",
to: "[email protected]",
subject: "My email",
body: template.render(params)
}).send();
var memcache = require("google/appengine/api/memcache");
var fragment = memcache.get("fragment");
if (!fragment) {
...
memcache.set("fragment", fragment);
}
var users = require("google/appengine/api/users");
var user = users.getCurrentUser();
if (users.isCurrentUserAdmin()) {
...
}
var url = user.createLoginURL();
var taskqueue = require("google/appengine/api/labs/taskqueue");
taskqueue.add({url: "/worker", method: "GET", params: {par1: "hello", par2: "world"}});
var task = new Task({url: "/worker", method: "GET", params: {par1: "hello", par2: "world"}});
task.add("customqueue");
var Article = require("article").Article,
ModelForm = require("google/appengine/ext/db/forms").ModelForm,
ArticleForm = ModelForm(Article);
...
var form = new ArticleForm(params, {instance: article});
...
form.save();
For an example of the usage of this library have a look at the example/ directory. For a more advanced example have a lok at the blog-gae example.
This library is under construction but usable. Substantial parts of the Python API are converted.
This is a community project, not affiliated in any way with Google.
is a service of Google, Inc. Copyright (c) 2009 , all rights reserved.
Copyright (c) 2009-2010 George Moschovitis, http://www.gmosx.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.