// const express = require('express')
// const TextToSVG = require('text-to-svg')
// const fs = require('fs')
// const textToSVG = TextToSVG.loadSync('./static/Dubai-Bold.otf')
// const app = express()
// const lineLengthviewer = (oneLineText) => { //to view the length of each line by pixel
// let {width} = textToSVG.getMetrics(oneLineText, options = {fontSize: 14})
// console.log('This line width is: ', width)
// }
// let svgFormat = ''
// svgFormat = svgFormat.replaceAll('"/> { //to view the length of each line by pixel
let {width} = textToSVG.getMetrics(oneLineText, options = {fontSize: fontSize})
console.log('This line width is: ', width)
}
app.use(express.json())
app.post('/textToSVG', (req, res) => {
console.log(req);
console.log(req.body);
let text = req.body.text
let screenSize = req.body.screenSize
let userFontSize = req.body.fontSize
let svgFormat = ''
svgFormat = svgFormat.replaceAll('"/> {
const filePath = path.join(__dirname, '/static/mySVG.svg')
console.log(filePath)
res.status(200).sendFile(filePath)
})
const port = process.env.PORT || 3000
app.listen(port, () => {
console.log('App is listening on port ', port);
});