Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lowdb doesn't create database #597

Open
uniboxx opened this issue Sep 18, 2024 · 0 comments
Open

lowdb doesn't create database #597

uniboxx opened this issue Sep 18, 2024 · 0 comments

Comments

@uniboxx
Copy link

uniboxx commented Sep 18, 2024

Hi, here my code:

import { JSONFilePreset } from 'lowdb/node';

const defaultData = { posts: [] };
const db = await JSONFilePreset('db.json', defaultData);

If I run the server with this code the db.json doesn't be created.
It will if I add this line.

db.write();

As I see in the instructions it should work without the last line. Any suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant