JavaScript Surreal Driver
npm install surrealdb-driverws.
select from persons table:
(async () => {
const surreal = new Surreal({
host: '127.0.0.1',
port: 8000,
user: 'user',
pass: 'password',
ns: 'myNamespace',
db: 'myDatabase',
ssl: false,
});
await surreal.signIn();
const persons = await surreal.select<
{company: string; id: string; name: string; skills: string[]}[]
>('persons');
persons.forEach((e) => console.log(e));
})();
`
Result:
`
{
company: 'SurrealDB',
id: 'users:x173nmutw0nzrt4fnixz',
name: 'Tobie',
skills: [ 'Rust', 'Go', 'JavaScript' ]
}
``