CoolFace
Apppublic

jbilcke-hf/template-node-python-express

sourceHugging Faceupdated 3y agoView on Hugging Face
2likes
index.mts22 linesDownload Raw Back to src
1import express from 'express'2import { python } from 'pythonia'3 4const { date } = await python('datetime')5 6const app = express()7const port = 78608 9app.get('/', async (req, res) => {10  const today = await date.today()11  res.write(`<html>12  <head><title>Hello.</title></head>13  <body>14    <div>Python says: today's date is ${15      await today.strftime("%d/%m/%Y")16    }</div>17  </body>18</html>`)19  res.end()20})21 22app.listen(port, () => { console.log(`Open http://localhost:${port}`) })