Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuhexiong/ipfs-file-api-golang
https://github.com/yuhexiong/ipfs-file-api-golang
backend backend-api file gin go golang ipfs postgres postgresql
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/yuhexiong/ipfs-file-api-golang
- Owner: yuhexiong
- Created: 2024-04-16T08:53:07.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-06T03:25:25.000Z (8 months ago)
- Last Synced: 2024-12-03T14:58:42.908Z (23 days ago)
- Topics: backend, backend-api, file, gin, go, golang, ipfs, postgres, postgresql
- Language: Go
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IPFS File API
A backend server provides an API for uploading and downloading files to IPFS, and stores file CID in a PostgreSQL database.## Overview
- Language: Go v1.21.4
- Web FrameWork: Gin v1.9.1
- DataBase: PostgreSQL v15.1
- File Server: ipfs v0.27.0## Run
### Update Modules
```
go get -u && go mod tidy -v
```### Dependency Injection
```
wire ./...
```### Generate Swagger
```
swag init -g cmd/main.go# swagger run at:
# http://localhost:${API_PORT}/api/swagger/index.html
```### Run
```
go run cmd/main.go
```## ENV
copy .env.default and rename as .env
```
API_PORT=9090
POSTGRES_HOST=
POSTGRES_PORT=5432
POSTGRES_USER=root
POSTGRES_PASSWORD=password
POSTGRES_DB=
IPFS_HOST=ipfs:5001
```## API
### File CID
- GET /api/file-cid/{id}: 取得檔案
- POST /api/file-cid/{name}: 上傳檔案