File size: 485 Bytes
0b7e92d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}`) })