Hi, i just started learning faunadb and need help with the start. I’m using JS driver with typescript - NativeScript + Angular - so i import module like this
import * as fauna from 'faunadb';
Then i instantiated a client and tried to create a collection
` const client = new fauna.Client({ secret: 'fnAD2w2d7MACAVxxxxxxxxxxxxxxxxxxxxxxxxx' });
const q = fauna.query;
let createP = client.query(
q.Create(
q.Collection('test'),
{ data: { testField: 'testValue' } }
)
)
createP.then(response => {
console.log(response); // Logs the ref to the console.
}) `
but an error occurs
` ERROR in …/node_modules/node-fetch/lib/index.mjs 1039:21-25
"export ‘default’ (imported as ‘http’) was not found in ‘http’
@ …/node_modules/cross-fetch/dist/node-ponyfill.js
@ …/node_modules/faunadb/src/Client.js
@ …/node_modules/faunadb/index.js
@ ./app/home/home.component.ts
@ ./app/home/home.module.ts
@ ./app/tabovi/tabovi-routing.module.ts
@ ./app/tabovi/tabovi.module.ts
@ ./app/app-routing.module.ts
@ ./app/app.module.ts
@ ./main.ts
ERROR in …/node_modules/node-fetch/lib/index.mjs 1406:56-60
"export ‘default’ (imported as ‘http’) was not found in ‘http’
@ …/node_modules/cross-fetch/dist/node-ponyfill.js
@ …/node_modules/faunadb/src/Client.js
@ …/node_modules/faunadb/index.js
@ ./app/home/home.component.ts
@ ./app/home/home.module.ts
@ ./app/tabovi/tabovi-routing.module.ts
@ ./app/tabovi/tabovi.module.ts
@ ./app/app-routing.module.ts
@ ./app/app.module.ts
@ ./main.ts `
Does anyone know what is wrong?