@koolamusic lowdb is a new one for me so thanks for making me away of it – i can think of some cases where it could be rather useful
So – this is without trying it – I have two thoughts:
1 - I bet you could get it to work in dev/local (or some other environment you control). Simply write your sdl by hand, create a service and instead of using the Prisma API use lowdb’s. This isn’t very unlike writing your own service and using any third party api to call Contentful, some other GraphQL service … or really anything else that returns data.
2 - It won’t really work because when you deploy (say to Netlify) you cannot write to it. Prisma cannot write to the SQLite database either when deployed. And even if you could write to the file, how would you persists changes on the next subsequent deploy?
2a) But for reads and just reads? Maybe it could. Depending on the size though you’d want to take care what is in the repo. You’d use the
const adapter = new FileAsync(‘db.json’)
since the api side cannot access localStorage.
And the file would likely have to live in the functions dir so it is zipped and shipped up on Netlify deploy.
Note if you just need to store (well, read and write it) JSON (without filtering it), Postgres (and Prisma) supports Json datatypes. I’m using some now and the parsed info comes right back in as a response to a gql query.
Hi Andrew! I also think this has super interesting potential. Especially since AWS Elastic File System now works with AWS Lambdas! This means serverless functions can now have storage