T10 Postman · Lesson 3
Games: Environments and variables
Choose the right option, fill in the blanks, write small pieces of code and fix broken ones. Code runs in a safe box inside this page.
Solved 0 of 44 items in this lesson.
1 / 22
This program runs a collection against a yard (server.js: GET /yard answers its name; GET /gauges/:name, boiler 95 and pump 40; POST /readings stores a reading with a new id, from 1; GET /readings/:id). What does it print?
cat > app.js <<'END'
const newman = require("newman");
const yard = require("./server");
const collection = {
info: { name: "Engine Hall gauges" },
item: [
{ name: "which", request: "{{baseUrl}}/yard" },
],
};
const server = yard("practice").listen(3000, () => {
newman.run({ collection, environment: { name: "practice yard", values: [{ key: "baseUrl", value: "http://localhost:3000" }] } }, () => server.close())
.on("request", (err, args) => console.log(args.response.text()));
});
END
node app.js