jbilcke-hf HF Staff commited on
Commit
2b585ed
·
1 Parent(s): 9ecbad2

removing the code to exit nicely, as we cannot exist nicely

Browse files
Files changed (2) hide show
  1. public/README.md +0 -1
  2. src/index.mts +1 -15
public/README.md DELETED
@@ -1 +0,0 @@
1
- Put public file assets here.
 
 
src/index.mts CHANGED
@@ -1,15 +1,11 @@
1
  import express from 'express'
2
  import { python } from 'pythonia'
3
 
4
- // make it easier to import local Python modules
5
- const sys = await python('sys')
6
- await sys.path.insert(0, '.')
7
-
8
  const { date } = await python('datetime')
9
 
10
  const app = express()
11
  const port = 7860
12
- app.use(express.static('public'))
13
  app.get('/', async (req, res) => {
14
  const today = await date.today()
15
  res.write(`<html>
@@ -23,14 +19,4 @@ app.get('/', async (req, res) => {
23
  res.end()
24
  })
25
 
26
- process.on('SIGINT', () => {
27
- try {
28
- (python as any).exit()
29
- } catch (err) {
30
- // exiting Pythonia can get a bit messy: try/catch or not,
31
- // you *will* see warnings and tracebacks in the console
32
- }
33
- process.exit(0)
34
- })
35
-
36
  app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
 
1
  import express from 'express'
2
  import { python } from 'pythonia'
3
 
 
 
 
 
4
  const { date } = await python('datetime')
5
 
6
  const app = express()
7
  const port = 7860
8
+
9
  app.get('/', async (req, res) => {
10
  const today = await date.today()
11
  res.write(`<html>
 
19
  res.end()
20
  })
21
 
 
 
 
 
 
 
 
 
 
 
22
  app.listen(port, () => { console.log(`Open http://localhost:${port}`) })