You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1.2 KiB

Image Server

Remaining:

  • parameterize bucket for test server

  • try American Cloud

  • dockerize

  • pretty-up the client, show thumbnail

setup

sh <(curl https://pkgx.sh) +pnpm sh
pnpm install
# create the directory for files that are being uploaded; should stay empty afterward
mkdir uploads
pnpm run migrate

Now set up an AWS S3 bucket & Infura project, and manually set these variables inside a .env file:

AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_REGION=

INFURA_PROJECT_ID=

dev

node server.js

test

# run this first command in a directory where `npm install did-jwt` has been run
CODE='OWNER_DID="did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F"; OWNER_PRIVATE_KEY_HEX="2b6472c026ec2aa2c4235c994a63868fc9212d18b58f6cbfe861b52e71330f5b"; didJwt = require("did-jwt"); didJwt.createJWT({ exp: Math.floor(Date.now() / 1000) + 60, iat: Math.floor(Date.now() / 1000), iss: OWNER_DID }, { issuer: OWNER_DID, signer: didJwt.SimpleSigner(OWNER_PRIVATE_KEY_HEX) }).then(console.log)'
JWT=`node -e "$CODE"`; curl -X POST -H "Authorization: Bearer $JWT" -F "image=@./test.png" http://localhost:3001/image

deploy to prod first time

  • Do the necessary steps from "setup" above.

  • In AWS, set up bucket and erase any test data.