Skip to content

Commit

Permalink
adding back reset code
Browse files Browse the repository at this point in the history
  • Loading branch information
jlawson committed Aug 17, 2018
1 parent 67ddfec commit ca947c0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ const middleware = jsonServer.defaults();
const port = process.env.PORT || 5000;
const pages = ["futurama", "avatar", "baseball", "recipes", "fakebank"];

server.get("/reset", (req, res) => {
pages.forEach(page => {
fs.copyFile(
`./${page}/${page}.json.backup`,
`./${page}/${page}.json`,
err => {
if (err) {
console.error(err);
}
}
);
});
res.end("ok");
});

server.use(middleware);

pages.forEach(page => {
Expand Down

0 comments on commit ca947c0

Please sign in to comment.