1.0.1 • Published 9 months ago
@nitra/tfm-node v1.0.1
@nitra/tfm-node
usage with node
import tf from '@nitra/tfm'
// eslint-disable-next-line n/no-extraneous-import
import Fastify from 'fastify'
const fastify = Fastify()
const tr = {
'Привіт Сонечко ': { en: 'Hello Sun ', lv: 'Sveika Saulīte ', ee: 'Tere Päike ' }
}
// Declare a route
fastify.post('/', {}, function (req, reply) {
const t = tf.bind({ tr, lang: req.headers.lang })
reply.send({ result: t`Привіт Сонечко ` })
})
// Run the server!
fastify.listen({ port: 3000 })