chore(server): update readme

This commit is contained in:
tsukino
2024-02-20 23:50:34 +08:00
committed by tsukino
parent 144c896c29
commit 4b90377cb3
2 changed files with 31 additions and 1 deletions

View File

@@ -11,6 +11,8 @@
"watch:server": "NODE_ENV=development webpack --config webpack.server.config.js --watch",
"nodemon:server": "NODE_ENV=development nodemon build/server/index.bundle.js",
"dev:server": "NODE_ENV=development concurrently npm:watch:server npm:nodemon:server",
"start": "node build/server/index.bundle.js",
"build": "concurrently npm:build:ui npm:build:server",
"dev": "concurrently npm:watch:ui npm:dev:server"
},
"repository": {

View File

@@ -8,8 +8,36 @@ npm i
npm run dev
```
## Build
## Build and Start
```bash
npm i
npm run build
npm start
```
## Server API
### POST /upload
Request:
```
curl -F 'data=@/path/to/file' http://localhost:3000/upload
```
Response:
```
// CID string
bafkreihlmzaynphb7cunvjjsm25w3uw5dbqvifq3wzppw33jztqqrx6oqi
```
### GET /ipfs/:cid
Request:
```
curl http://localhost:3000/ipfs/bafkre....tqqrx6oqi
```
Response:
```
download file bafkre....tqqrx6oqi.json
```