This is an easily deployable json-server, self-resetting its database every hour.
A recent frontend bootcamp graduate was struggling with deploying their projects, based on json-server
"backend".
Keeping in mind that deployment only might not be enough, as databases could be polluted by bad internet actors, I came up with this "groundhog day" idea, which will wipe database to a pre-saved state every hour.
This way it should be good enough to demo projects' functionality, but also keep them in intended state for future visitors.
tl;dr way to deploy on Glitch
- open this Glitch project
- click "Remix" to have your own copy
- edit
db.json
in there - this will be the pointjson-server
will reset automatically to - grab the deployment address using "show", it should end with
.glitch.me
- point your frontend project to use that address as its backend
- profit, enjoyment, etc :D
- 💡 tip: the fastest way to deploy your React/static project is Render
This repo can be cloned, db.json
changed and deployed to any service able to host Node (Heroku, AWS, Vercel, DigitalOcean, Google, Azure, you name it).
- you can run it locally via
npm run develop
, it will watch and save changes intodb.json
, which is probably what you want while working on your frontend - db reset interval can be changed in
server.js
- locally default port is
3100
, change it inpackage.json
if needed