Skip to content

ACE’s integration modules (M4 to M6) assume four small skills: reading and writing JSON, understanding an HTTP request and its answer, reading and editing simple TypeScript or JavaScript, and running commands in a terminal. This page is the optional primer for them, outside the course’s hours: a summary, a self-check, and where to practise. If the self-check on the course page went well, you do not need it.

ToolWhat it is for in ACEInstall, then check
A code editorWriting the Function and client filesAny editor that shows line numbers
Node.js 20 or later, with npmRunning and building TypeScript and JavaScriptFrom the Node.js website or your package manager; node --version
curlSending HTTP requests from the terminalBuilt into most systems; curl --version
jqReading JSON answers in the terminalFrom its website or your package manager; jq --version
zipPackaging a FunctionBuilt into most systems; zip -v

Ten commands cover the course: cd folder (go into a folder), ls or dir (list it), mkdir -p a/b (make folders), cp -r a b (copy a folder), export NAME="value" (set a variable for this terminal; in Windows PowerShell, $env:NAME="value"), echo $NAME (show it), npm install, npm run build, npm start, and Ctrl+C (stop a running program).

JSON writes data as objects in braces, with "key": value pairs, and arrays in brackets. Values are text in double quotes, numbers, true, false, null, or another object or array.

{ "success": true, "result": { "count": 3, "items": [ { "id": "a1" }, { "id": "b2" } ] } }

You reach a value by following the keys from the outside in: result.count is 3, and result.items[1].id is "b2" (arrays count from 0). In jq the same paths start with a dot: jq '.result.items[1].id'.

A request has a method (GET reads, POST creates, PATCH and PUT change, DELETE removes), an address, headers (name: value pairs, for example the credential), and for writes a body, usually JSON. The answer has a status and a body.

StatusMeans
200, 201It worked (201: something was created)
400, 422Your request is wrong: fix it, do not resend it unchanged
401No valid credential
403A valid credential without access to this
404Not found: a wrong address, name or id
409Conflict: something changed since you read it
429Too many requests: wait and retry
5xxThe server side failed or is unavailable

With curl: -H 'name: value' adds a header, -d '{...}' sends a body, -X POST sets the method, -G --data-urlencode 'key=value' adds an encoded query parameter, -s stays quiet and -i shows the status line.

const total = (a: number, b: number) => a + b; // a function; ": number" is a type
const answer = { success: true, result: { total: total(2, 3) } };
if (!answer.success) { throw new Error('failed'); } // stop with an error
const rate = Number('0.25') || 0; // text to a number, 0 if it is not one
for (const item of [1, 2, 3]) { console.log(item); } // a loop
const res = await fetch(url); // wait for an HTTP answer
const body = await res.json(); // read its JSON body

TypeScript is JavaScript with types; npm run build turns it into JavaScript and reports type mistakes before anything runs. In ACE you read and adjust programs printed in full; you do not design them from nothing.

  1. Send curl -s to any public JSON address you like, and read one nested value with jq.
  2. In an empty folder, write hello.mjs containing console.log(JSON.stringify({ ok: true })) and run node hello.mjs.
  3. Change it to print a variable you set with export (read it as process.env.NAME).

If all three work, you are ready for Module 4.