Skip to content

Commit

Permalink
dotenv, tsconfig settings and basic bucket list functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
MoMannn committed Dec 20, 2023
1 parent c5b6661 commit 52df818
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 126 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
70 changes: 70 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
"main": "dist/index",
"scripts": {
"start": "nodemon --exec npx ts-node src/index.ts",
"identity": "npx ts-node ./src/identity.ts"
"identity": "npx ts-node ./src/identity.ts",
"storage:get-buckets": "npx ts-node ./src/storage-get-buckets.ts"
},
"devDependencies": {
"nodemon": "^3.0.1"
},
"dependencies": {
"@apillon/sdk": "1.2.0-beta.1",
"@types/node": "20.10.5",
"dotenv": "^16.3.1",
"ts-node": "10.9.2",
"typescript": "5.3.3"
}
Expand Down
18 changes: 15 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
console.log("Hello developer");
console.log("\n");
console.log("We have prepared multiple script for you to run.");
console.log(`
Hello developer
We have prepared multiple script for you to run so you can see Apillon SDK in action.
You will need to send ENV variables with you API key and secret to run examples.
If you are running in codesandbox be careful of exposing the keys.
We have all major functionalites as examples so you can run scripts:
- npm run storage:buckets
- npm run storage:bucket-content
- npm run storage:bucket-upload
- npm run identity:generate-signing-message
`);
16 changes: 16 additions & 0 deletions src/storage-get-buckets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Storage } from "@apillon/sdk";
import * as dotenv from "dotenv";

dotenv.config();

(async () => {
const storage = new Storage({
key: process.env.APILLON_API_KEY,
secret: process.env.APILLON_API_SECRET,
});

const buckets = await storage.listBuckets();
console.log(buckets);
})().catch(async (err) => {
console.log(err);
});
7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"include": ["src"],
"compilerOptions": {
"module": "commonjs",
"module": "Node16",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"target": "ES2022",
"sourceMap": true,
"outDir": "./dist",
"resolveJsonModule": true,
"incremental": true
"incremental": true,
"moduleResolution": "node"
}
}
Loading

0 comments on commit 52df818

Please sign in to comment.