diff --git a/docs/examples/deno/deno.jsonc b/docs/examples/deno/deno.jsonc index 72094e3..8ca9f00 100644 --- a/docs/examples/deno/deno.jsonc +++ b/docs/examples/deno/deno.jsonc @@ -1,6 +1,6 @@ { "lock": false, "tasks": { - "dev": "deno run --watch --allow-all --reload ./main.ts" + "dev": "deno run --watch --allow-all --reload --unstable-sloppy-imports ./main.ts" } } diff --git a/docs/examples/deno/main.ts b/docs/examples/deno/main.ts index f036933..d587cf1 100644 --- a/docs/examples/deno/main.ts +++ b/docs/examples/deno/main.ts @@ -1,8 +1,3 @@ -// import { -// CurrencyCode, -// encode, -// PaymentOptions, -// } from "../../../dist/index.js"; import { CurrencyCode, encode, diff --git a/docs/examples/express/package.json b/docs/examples/express/package.json deleted file mode 100644 index 352035f..0000000 --- a/docs/examples/express/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "author": "Filip Seman", - "type": "module", - "proxy": "http://localhost:4000", - "scripts": { - "start": "tsx server.ts" - }, - "dependencies": { - "bysquare": "latest", - "express": "~4.18.0" - }, - "devDependencies": { - "tsx": "~3.12.0" - } -} diff --git a/docs/examples/express/public/favicon.ico b/docs/examples/express/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/docs/examples/express/public/index.html b/docs/examples/express/public/index.html deleted file mode 100644 index 7d4bbee..0000000 --- a/docs/examples/express/public/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
Loading...
- - - - - diff --git a/docs/examples/express/server.ts b/docs/examples/express/server.ts deleted file mode 100644 index c1fe35e..0000000 --- a/docs/examples/express/server.ts +++ /dev/null @@ -1,43 +0,0 @@ -// import { DataModel, encode, PaymentOptions } from "./../../../dist/index.js" -import { - CurrencyCode, - DataModel, - encode, - PaymentOptions, -} from "bysquare"; -import express from "express"; - -const model = { - invoiceId: "random-id", - payments: [ - { - type: PaymentOptions.PaymentOrder, - amount: 100.0, - bankAccounts: [ - { iban: "SK9611000000002918599669" }, - ], - currencyCode: CurrencyCode.EUR, - variableSymbol: "123", - beneficiary: { - name: "Filip", - city: "City", - street: "Street", - }, - }, - ], -} satisfies DataModel; - -const publicFolder = express.static("./public"); -const app = express(); - -app.use("/", publicFolder); - -app.get("/qr", async (_req, res) => { - const qrstring = await encode(model); - console.log(qrstring); - res.send(qrstring); -}); - -app.listen(4_000, () => { - console.log(`Example app listening at http://localhost:${4_000}`); -}); diff --git a/docs/examples/express/.npmrc b/docs/examples/nodejs/.npmrc similarity index 100% rename from docs/examples/express/.npmrc rename to docs/examples/nodejs/.npmrc diff --git a/docs/examples/nodejs/main.ts b/docs/examples/nodejs/main.ts new file mode 100644 index 0000000..5d5cfc7 --- /dev/null +++ b/docs/examples/nodejs/main.ts @@ -0,0 +1,33 @@ +import { + CurrencyCode, + encode, + PaymentOptions, +} from "./../../../src/index.js"; +// import { +// CurrencyCode, +// DataModel, +// encode, +// PaymentOptions, +// } from "bysquare"; + +const encoded = encode({ + invoiceId: "random-id", + payments: [ + { + type: PaymentOptions.PaymentOrder, + amount: 100.0, + bankAccounts: [ + { iban: "SK9611000000002918599669" }, + ], + currencyCode: CurrencyCode.EUR, + variableSymbol: "123", + beneficiary: { + name: "Filip", + city: "City", + street: "Street", + }, + }, + ], +}); + +console.log(encoded); diff --git a/docs/examples/nodejs/package.json b/docs/examples/nodejs/package.json new file mode 100644 index 0000000..c6fc066 --- /dev/null +++ b/docs/examples/nodejs/package.json @@ -0,0 +1,13 @@ +{ + "author": "Filip Seman", + "type": "module", + "scripts": { + "start": "node --no-warnings --loader=ts-node/esm ./main.ts" + }, + "dependencies": { + "bysquare": "latest" + }, + "devDependencies": { + "ts-node": "~10.9.0" + } +}