Skip to content

Commit

Permalink
installed prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
jzakotnik committed Aug 4, 2021
1 parent 934e102 commit 61e2993
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nextjs/mwe/pages/api/insertData.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ export default function handler(req, res) {
var db = level("./lunchdb");
console.log("Inserting data into DB");
console.log(req.body);

const authid = req.body.authid;
const lunchprofile = req.body.dayselection;

db.get(authid.admin, function (err, value) {
if (err) {
if (err.notFound) {
// handle a 'NotFoundError' here
return;
}
// I/O or other error, pass it up the callback chain
return callback(err);
}

// .. handle `value` here
});

db.put(
authid.admin,
JSON.stringify({ lunchprofile, reader: authid.reader, admin: true }),
Expand Down

0 comments on commit 61e2993

Please sign in to comment.