Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created August 3, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azaharafernandezguizan/2e29e838030d665528fcd77ca49f68b0 to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/2e29e838030d665528fcd77ca49f68b0 to your computer and use it in GitHub Desktop.
Example of deno post working
const addConditions = async ({ request, response}
: {request: any, response:any}) =>{
const body = await request.body();
if (!request.hasBody) {
response.status = 400
response.body = {
success: false,
message: 'KO'
}
} else {
const result = request.body({ type: "json" });
const conditions = await result.value as IReceivedConditions;
formMealsMenu(conditions);
response.status = 201
response.body = {
success: true,
message: 'OK'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment