I created a database in Directus. I created a separate project for the site, where I will add data. Installed @ directus / sdk. image
But when importing, I get an error
Uncaught SyntaxError: Cannot use import statement outside a module
this is my code
import { Directus } from '@directus/sdk';
const directus = new Directus('https://api.example.com/');
await directus.auth.login({
email: 'admin@example.com',
password: 'pass',
});
const articles = await directus.items('articles').readMany();
console.log({
items: articles.data,
total: articles.meta.total_count,
});
How do I fix this error? Is it correct to create a separate project for the site? Or could it be done in the same place as the database?