To install AtosJS, choose your preferred package manager:
npm
Terminal
npm install atosjs@latest
Main File (index.js
)
index.js
const { GiftManager } = require("atosjs");
(async () => {
const gift = new GiftManager({
logging: true, // enables log messages (default is 'true')
atosdb: { filePath: "gifts.sqlite" }, // using AtosDB with a custom file
});
const coin = await gift.generate({
type: "coin",
value: 100,
});
console.log({
GiftId: coin,
log: await gift.view(coin),
});
})();
Expected Output
After running the file:
Terminal
✔ Connected to 🚀 AtosDB (gifts.sqlite) 2:19:32 AM
{
GiftId: 'YAE81969XD4DG',
log: {
valid: true,
type: 'coin',
value: 100,
edited: { maxRedeem: 1, redeemedCount: 0, expiresAt: 'lifetime' }
}
}
Project Structure
- index.js
- gifts.sqlite
- package.json
Last updated on: