docs/manual: Fix JavaScript section

The API changed so fix that up. Also improve flow of text.
This commit is contained in:
Pekka Enberg
2025-08-13 12:26:31 +03:00
parent 9a0d5cebe9
commit ece8f106d9

View File

@@ -324,6 +324,8 @@ turso> SELECT * FROM t;
Turso supports a JavaScript API, both with native and WebAssembly package options.
Please read the [JavaScript API reference](docs/javascript-api-reference.md) for more information.
### Installation
Installing the native package:
@@ -338,19 +340,15 @@ Installing the WebAssembly package:
npm i @tursodatabase/database --cpu wasm32
```
### API reference
See [JavaScript API reference](docs/javascript-api-reference.md) for more information.
### Getting Started
To use Turso from JavaScript application, you need to import `Database` type from the `@tursodatabase/database` package.
You can the prepare a statement with `Database.prepare` method and execute the SQL statement with `Statement.get()` method.
```
import Database from '@tursodatabase/database';
import { connect } from '@tursodatabase/database';
const db = new Database('turso.db');
const db = await connect('turso.db');
const row = db.prepare('SELECT 1').get();
console.log(row);
```