I am trying to introduce edgeDB into a current sveltekit project. No matter what configuration I try, I get the error below. I have run "edgdb project init" and I have a dbschema directory already. I am missing something. I haven't fully groked the whole edgeDB paradigm yet, but just experimenting to get off the runway.
ClientConnectionError: Found 'edgedb.toml' but the project is not initialized. Run `edgedb project init`.
edgedb.toml and dbschema are in the root directory with svelte.config.js and so forth.
svelte.config.ts
...
kit: {
adapter: adapter(),
alias: {
$dbschema: './dbschema',
$db: 'dbschema/edgeql-js'
}
}
...
I have route/test/+page.server.ts:
import e from '$dbschema/edgeql-js';
import { client } from '$lib/db/edgedb';
import { selectPosts } from './queries';
export const load: PageServerLoad = async ({locals}) => {
// const query = e.select(e.datetime_current());
// const result = await query.run(client);
// locals.datetime = result;
//let posts = await selectPosts().run(client)
selectPosts.run(client)
return {
status: 200,
headers: {
'Content-Type': 'application/json'
},
body: {
// datetime: result
datetime: 'test'
}
};
}
route/test/+page.svelte
<script>
export let data;
</script>
{data.body.datetime}
routes/test/queries.ts
import e from '$dbschema/edgeql-js';
export const selectPosts = e.select(e.Post, () => {
return {
id: true,
title: true
};
});
lib/db/edgedb.ts
import { createClient } from 'edgedb'
export const client = createClient()