Skip to content

A QR code generator that generates QR codes in ASCII format using qrcode-terminal.

License

Notifications You must be signed in to change notification settings

christofferEkblom/ascii-qr-code-generator

Repository files navigation

ASCII QR code generator

Application demo

Description

A QR code generator that generates QR codes in ASCII format using qrcode-terminal.

Features

  • 🎤 Live preview
  • 🖥 API
  • 💾 Sample data
  • ✂️ Fast copy & paste

API

For everyone

💬 Get QR code

curl {SCHEME}://{HOST}:{PORT}/api/get-qr?data={DATA}

For example, data=https://github.com/christofferEkblom/ascii-qr-code-generator will give this response:

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▀▀ ██▀█ █▀█▄▀█▄ ██ ▄▄▄▄▄ █
█ █   █ █▄▀██▀▀█▄█▄▀█▄█ ▀██ █   █ █
█ █▄▄▄█ █ ▄ █ █▄ ▄▀█▀▄▀▀▄▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█ █ ▀▄▀▄▀▄▀▄█▄▀▄█ █▄▄▄▄▄▄▄█
█▄ █ █▀▄ ▀▀█  ▀▄█▀█▄▄▀ ▀█ ▀ ▄▄▀▄▄▀█
█ ▀█ ▀▄▄▄ ▀▀   ▄▀▄█▀ ▀ ██ ▄▄█ ▄█▀ █
█▀ ▄ ▄▀▄█▀▀▄ █▀ █▄ █  ▀▀█▀▄ ▀▀ ▀▀ █
███▀▄  ▄█ ██ █▄▄█▄▀ █▄▀▀▄█▄ ▀█ █ ██
█▀▄█▀█▀▄ ▀▄██  ▀█  █▄▄▄▄▀▀▀▄█▄▀▀█▄█
██▄▀ ▀ ▄█▄▄▀▄ █ ▀█ ▀▀█ ▄▀█ █▄  █▄▄█
███▀  ▀▄▄▀ █▀██▀█ ▀██  ██ ▀▀▄█▄▀▄▀█
█▄ ▀   ▄  ▀████▀█▀██ ▀ █▀▄██▀▀ █▀ █
█▄██▄▄▄▄█▀█ ▀ ██▄▄ █▀ ▄▀█ ▄▄▄ ███▀█
█ ▄▄▄▄▄ █▄▀██ ▀▀▀▀ ▀█ ▀██ █▄█ ██ ██
█ █   █ █▀▄ ▄█▄▄█▀ ▄█ ▄▄█▄▄   █▀███
█ █▄▄▄█ █▀▀▄▀█ ███▀▀█▀ █▀▀██  ▄▄█▄█
█▄▄▄▄▄▄▄█▄▄▄▄▄█▄█▄██▄█▄██▄▄▄▄▄██▄██

🎲 Get random sample data post

curl {SCHEME}://{HOST}:{PORT}/api/get-random-sample-data

👐 Get sample data list

curl {SCHEME}://{HOST}:{PORT}/api/get-sample-data-list

For administrator

🔐 Obtain an access token

curl {SCHEME}://{HOST}:{PORT}/oauth/token \
  -d "grant_type=client_credentials" \
  -H "Authorization: Basic base64({CLIENT ID}:{CLIENT SECRET})" \
  -H "Content-Type: application/x-www-form-urlencoded"

For example, to use user:secretcode, you can type the following (if you have OpenSSL installed):

echo -n 'user:secretcode' | openssl base64

The output should be dXNlcjpzZWNyZXRjb2Rl. Therefore, you should send:

Authorization: Basic dXNlcjpzZWNyZXRjb2Rl

📬 Create new sample data post

curl --data "data={POST DATA}" {SCHEME}://{HOST}:{PORT}/api \
  -H "Authorization: Bearer {ACCESS TOKEN}"

🗑 Delete sample data post

curl -X "DELETE" {SCHEME}://{HOST}:{PORT}/api/{POST ID} \
  -H "Authorization: Bearer {ACCESS TOKEN}"

Installation guide

  1. Clone this repository
git clone https://github.com/christofferEkblom/ascii-qr-code-generator.git
  1. Go to the directory
cd ascii-qr-code-generator
  1. Create .env file for the environment variables
nano .env
  1. Set the following variables:
PORT = {APPLICATION PORT NUMBER}
MONGODB_CONNECTION_STRING = {MONGO DB CONNECTION STRING}
OAUTH2_CLIENT_ID = {CLIENT ID}
OAUTH2_CLIENT_SECRET = {CLIENT SECRET}
  1. Install the npm packages
npm install
  1. 🏁 Finish! To run the application, type:
npm start

Tech

  • Node.js
  • oauth2
  • SASS
  • MongoDB

Developer

🇸🇪Christoffer Ekblom

License

📚 See license