Scaffold a new two-go API test project with a single command.
two-go is a zero-dependency fluent service and API testing library for Node. You build an HTTP request with a chainable API, attach checks, and await it.
npm create two-go@latest my-appYou can also pass any other project name, or omit it to use the default two-go-app:
npm create two-go@latestThe command creates a new directory containing a ready-to-run two-go project:
my-app/
package.json # type: module, test script, two-go dependency
api.test.mjs # a sample API test using the two-go fluent API
.gitignore # ignores node_modules and log files
The generated package.json uses your chosen project name and depends on two-go.
After scaffolding, install dependencies and run the test suite:
cd my-app
npm install
npm testThe sample test calls a public placeholder API and asserts on the response:
import { test } from "node:test";
import { go } from "two-go";
test("GET /todos/1 returns a todo", async () => {
await go("https://jsonplaceholder.typicode.com")
.get("/todos/1")
.expectStatus(200)
.expectJson("id", 1);
});- Node.js >= 18
MIT