I want to use sequalize but not with sqlite , postgres etc. . I want to put my data in JSON file is it possible ? Or is there any library like sequelize which i can use json file as a database ?
1 Answer
Yes! There are quite a few npm packages available which suits your requirement.
Here are few for your reference,
node-json-db - A simple "database" that use JSON file for Node.js project. - https://www.npmjs.com/package/node-json-db
disk-db - A Lightweight Disk based JSON Database with a MongoDB like API - https://www.npmjs.com/package/diskdb
low-db - JSON database for Node and the browser powered by lodash API - https://www.npmjs.com/package/lowdb
Hope this helps!
4 Comments
alda alda
Thanks a lot but i think its not possible to use with sequelize ? I wan to use with sequelize to create data models
David R
No. Unfortunately, Sequelize ORM is specifically designed to target databases which has transactional, relations support like PostgreSQL, MySQL, MariaDB, SQLite and MSSQL.
alda alda
Thanks then how can i limit data types without sequelize. For example i want to have an element like user in json and username cant be null and datatype is string
David R
Unfortunately, you can't achieve these features having a flat file
(.json) as a data store.