feat: add classroomio's server to the monorepo (#168)

* add classroomio server to apps

* ReadME upadte

* Update README.md

* rename project to backend

* fix lock file

---------

Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
Adeyemi Adetunji
2024-02-28 03:25:25 +01:00
committed by GitHub
co-authored by Rotimi Best
parent d040f9f12e
commit 3a22a73380
24 changed files with 8177 additions and 62 deletions
@@ -0,0 +1,35 @@
const express = require('express');
const zod = require('zod');
const { generateCertificate } = require('../utils/certificate');
const router = express.Router();
router.post('/', async (req, res) => {
try {
// Validate
const mySchema = zod.object({
theme: zod.string(),
studentName: zod.string(),
courseName: zod.string(),
courseDescription: zod.string(),
orgLogoUrl: zod.string(),
orgName: zod.string(),
});
console.log('req.body', req.body);
mySchema.parse(req.body);
const pdfBuffer = await generateCertificate(req.body);
res.contentType('application/pdf');
res.send(pdfBuffer);
} catch (error) {
console.error('Error', error);
res.json({
success: false,
error,
});
}
});
module.exports = router;