asdass1 commited on
Commit
746b714
·
verified ·
1 Parent(s): 4982da4

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +10 -6
index.js CHANGED
@@ -1,11 +1,15 @@
1
  import crc32 from './crc32.js'
2
  import http from 'axios'
3
- import koa from 'koa'
4
 
5
- const app = new koa
 
6
 
7
- app.use(async ctx => {
8
- const file_url = ctx.path.replace(/^\//, '')
 
 
 
9
  const file = await http({
10
  method: 'GET',
11
  url: file_url,
@@ -28,6 +32,6 @@ app.use(async ctx => {
28
  ctx.body = upload_result.data
29
  })
30
 
31
- app.listen(3001, () => {
32
- console.log('3001')
33
  })
 
1
  import crc32 from './crc32.js'
2
  import http from 'axios'
3
+ import express from 'express'
4
 
5
+ const app = express()
6
+ const port = 7860
7
 
8
+ app.use(express.json())
9
+ app.use(express.urlencoded({ extended: true }))
10
+
11
+ app.get('*', async (req, res) => {
12
+ const file_url = req.path.replace(/^\//, '')
13
  const file = await http({
14
  method: 'GET',
15
  url: file_url,
 
32
  ctx.body = upload_result.data
33
  })
34
 
35
+ app.listen(port, async () => {
36
+ console.log(`http://localhost:${port}`)
37
  })