QR-Generator is a simple web application that allows users to generate QR codes for product IDs and prices. The project consists of a Node.js backend for QR code generation and a frontend client for user input and displaying the resulting QR code.
- User Input: Enter a product ID and price to generate a QR code.
- Dynamic QR Generation: Generates a QR code image containing the product information.
- Downloadable QR Image: The generated QR code can be downloaded directly from the browser.
- Simple Web Interface: Clean and minimal UI for quick and easy QR code creation.
- The user fills out a form with a product
IDandPriceon the frontend. - On submission, the frontend sends this data to the backend server using a POST request.
- The backend formats this information and generates a QR code image using the
qrcodepackage. - The server responds with the QR code image, which is displayed on the page.
QR-Generator/
├── Client/
│ ├── index.html # Frontend HTML page
│ ├── script.js # Handles form and image display logic
│ └── style.css # Basic styling
└── Server/
├── app.js # Express server setup
├── routes.js # API route definition
├── controller.js # Handles QR generation logic
└── service.js # Data formatting and QR code creation
- Navigate to the
Serverdirectory:cd Server - Install dependencies:
npm install
- Start the server:
The server will run on
node app.js
http://localhost:3000.
- Open
Client/index.htmlin your web browser. - Enter a product ID and price.
- Click "Generate QR Code" to view and download your QR image.
- POST
/generate-qr- Body:
{ data: { id: string, price: string } } - Response: Returns a PNG image of the generated QR code.
- Body:
- Enter
ID: 12345,Price: 99.99 - Click "Generate QR Code"
- A QR code image appears, encoding:
Product ID: 12345, Price: $99.99