Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bernd Plontsch
1,617 PointsSimple data persistence with node.js
I just finished the two node workshops. Great stuff. As a next step I'd like to save some simple data (e.g. a little JSON file) on the server and load it when I visit the site again.
Would I use the "File System" api for writing and reading this? Any recommendations or common pitfalls I need to be aware of?
I also thought about using some sort of tiny database /framework for this but that might be too much in this case – or are there any simple solutions with a nice node interface?
1 Answer
Stephen Layton
8,643 Pointsnode-jsonfile might be just what your looking for: https://www.npmjs.com/package/jsonfile There are certainly other methods to do the same but grabbing a package is probably the easiest.
Bernd Plontsch
1,617 PointsBernd Plontsch
1,617 PointsThanks. Sounds good. I'll have a look.