Skip to content

Instantly share code, notes, and snippets.

@dioscarey
Created February 19, 2021 19:53
Show Gist options
  • Save dioscarey/ed1abc6b0761a13a52462af2b9641f68 to your computer and use it in GitHub Desktop.
Save dioscarey/ed1abc6b0761a13a52462af2b9641f68 to your computer and use it in GitHub Desktop.
const postFunction = async (ctx) => {
try {
const {id} = ctx.req.body;
const r = await ctx.db.getData(id);
// This respond function is customizable in your middleware
ctx.respond(200, r);
} catch(err) {
console.log(err);
ctx.respond(500);
}
}
module.exports = postFunction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment