'use strict'
is supported and enabled by default. You can turn it off by setting the file attribute { "useStrict int32": 0 }
.Math.random()
is seeded form the //request/info
file’s random
string attribute, which contains a base64 string,
currently 16 bytes long, storing a 64bit number. Its length may change in the future. You may want to override it when testing.new Date()
returns the current time with second granularity; the same value as returned by request.createdBy()
.require()
asserts that the target file uses the same file type sjs-4
.Content-Security-Policy
headers on the response, set the response
file’s
content-security-policy
string attribute.
For example: response.attrStr('content-security-policy', '...')
. response.body('hello world);
//# sourceMappingURL=data:application/json,SnVzdCBhIGR1bW15IGJhc2U2NCBleGFtcGxl
sjs-3
engineTo write a hello world
content app, create the following file structure:
/hello-world [type: "app-1"]
/hello-world/.Inline [type: "sjs-4"]
And put the following content in the .Inline
file:
response.body('hello world');
If it doesn’t show up on the page, you likely put the /hello-world
file in the
wrong bucket.
(A content app is an app embedded in a page, not a full page.)
To write a hello world
full page app, create the following file structure:
/hello-world [type: "app-1"]
/hello-world/.Request [type: "sjs-4"]
/hello-world/.Page
And put the following content in the .Request
file:
response.body('hello world');
The .Page
file is only needed to make it show up as menu entries.
The sjs-4 engine runs on the Goja VM.
.Inline
.Main
.Request