Giter Site home page Giter Site logo

dm-coffee's Introduction

This is a Next.js project bootstrapped with create-next-app.

Configuration

Configuration is done through environment variables. You can create a .env file in the root directory. See the file app/config.ts for the list of available environment variables.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

emulating the card reader

per simulare il passaggio della tessera 1234 bisogna mettere un token segreto nella variabile d'ambiente CARD_SECRET_TOKENS (si possono inserire più tokens separati da una virgola) e poi si può dare il comando

CODE=codice_tessera
CARD_SECRET_TOKEN=codice_segreto
curl 'http://localhost:3000/graphql' -H "Authorization: ${SECRET_TOKENS}" -H 'content-type: application/json' --data-raw '{"operationName":"Card","variables":{"code":"'"${CODE}"'"},"query":"mutation Card($code: String!) {\n  card(code: $code)\n}"}'

inserting a transaction with an API call

Per automatizzare l'inserimento delle transazioni da altre fonti (ad esempio dai pagamenti di paypal) si può fare una chiamataa alle API utilizzando un token invece che username e password di amministratore. Il token (un codice segreto) va inserito nella variabile d'ambiente ADMIN_SECRET_TOKENS (più token possono essere separati da virgola) e quindi si può fare una chiamata come segue:

ADMIN_SECRET_TOKEN=codice_segreto
[email protected]
amountCents=100 # centesimi
description="pagamento paypal"
curl "http://localhost:3000/graphql" -H "Authorization: ${ADMIN_SECRET_TOKEN}" -H "content-type: application/json" --data-raw '{"operationName":"SaveTransaction","variables":{"email":"'"${email}"'","amountCents":'"${amountCents}"',"description":"'"${description}"'"},"query":"mutation SaveTransaction($email: String, $amountCents: Int, $description: String) { transaction(email: $email\n amountCents:$amountCents\n  description: $description) }"}'

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

build docker image

docker build -t dm-coffee/dm-coffee:latest .

dm-coffee's People

Contributors

paolini avatar robol avatar

Watchers

 avatar  avatar Samuele Tognini avatar Antonio Cisternino avatar Davide Borgioli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.