1. Start
  2. An entity
  3. A source
  4. A rule
  5. A port
  6. A link
  7. A fact
  8. An app
  9. Split

One line, and the rows stay

Rows in memory are lost at every restart, so we add SQLite with one line in sources. The app then refuses to start until the table exists, and fougere migrate creates it.

Install
$ npm install @fougere/adapter-sql better-sqlite3
fougere.config.ts
1import '@fougere/adapter-rest';
+import '@fougere/adapter-sql';
3import { defineFougere } from '@fougere/core';
4
5export default defineFougere({
6 protocols: { rest: {} },
+ sources: { main: { type: 'sqlite', path: '.data/blog.db' } },a b c
8 fronds: { '@fougere/log': {} },
9});

point at a lettered line, or tap it, to see what grows from it

0 line changed under fronds/

The handler asks for its rows as before. Where they live is a line of config.

Try it
$ npx fougere migrate --latest --apply
◇  create posts
◆  1 change(s) applied.

On Postgres it is { type: 'pg', url: process.env.DATABASE_URL }, and nothing else in the project changes.

Built with Fougere and Nuxt, hosted on GitHub Pages.