Skip to content

Instantly share code, notes, and snippets.

@ShariqT
Created December 6, 2021 23:18
Show Gist options
  • Save ShariqT/30fd3fa58a41a4b7c1cc4ab333a26f77 to your computer and use it in GitHub Desktop.
Save ShariqT/30fd3fa58a41a4b7c1cc4ab333a26f77 to your computer and use it in GitHub Desktop.
postcard-list.js
import L from "lob";
export default async function listPostcards(req, res) {
const Lob = L(process.env.LOB_SECRET_API_KEY);
Lob.postcards.list(
{
limit: 50,
},
function (err, data) {
if (err) {
return res.status(err.status_code || 500).send({
success: false,
error_message:
err?._response?.body?.error?.message ||
err.message ||
"Unknown error.",
});
} else {
res.send({ success: true, postcards: data.data, count: data.count })
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment