character-ai / src /index.mts
rippanteq7's picture
Duplicate from jbilcke-hf/template-node-python-express
0b7e92d
raw
history blame
No virus
485 Bytes
import express from 'express'
import { python } from 'pythonia'
const { date } = await python('datetime')
const app = express()
const port = 7860
app.get('/', async (req, res) => {
const today = await date.today()
res.write(`<html>
<head><title>Hello.</title></head>
<body>
<div>Python says: today's date is ${
await today.strftime("%d/%m/%Y")
}</div>
</body>
</html>`)
res.end()
})
app.listen(port, () => { console.log(`Open http://localhost:${port}`) })