{"id":22484486,"url":"https://github.com/digitalocean/sample-functions-nodejs-qrcode","last_synced_at":"2025-08-02T17:33:00.009Z","repository":{"id":38244065,"uuid":"459710822","full_name":"digitalocean/sample-functions-nodejs-qrcode","owner":"digitalocean","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-01T21:53:10.000Z","size":21,"stargazers_count":27,"open_issues_count":1,"forks_count":30,"subscribers_count":5,"default_branch":"main","last_synced_at":"2023-03-12T03:02:48.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-15T18:57:27.000Z","updated_at":"2023-03-07T10:25:06.000Z","dependencies_parsed_at":"2023-02-01T01:02:09.538Z","dependency_job_id":null,"html_url":"https://github.com/digitalocean/sample-functions-nodejs-qrcode","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-nodejs-qrcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-nodejs-qrcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-nodejs-qrcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-nodejs-qrcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/sample-functions-nodejs-qrcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228499903,"owners_count":17929979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T17:11:04.078Z","updated_at":"2025-08-02T17:33:00.000Z","avatar_url":"https://github.com/digitalocean.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"\u003e ⚠️ **This repository is archived and kept for reference purposes only.**  \n\u003e It is no longer maintained and will not receive updates or support.\n\n# Sample Function: QR Code Generator\n\n## Introduction\n\nThis repository contains a sample QR code generator function. You can deploy it on DigitalOcean's App Platform as a Serverless Function component.\nDocumentation is available at https://docs.digitalocean.com/products/functions.\n\n### Requirements\n\n* You need a DigitalOcean account. If you don't already have one, you can sign up at [https://cloud.digitalocean.com/registrations/new](https://cloud.digitalocean.com/registrations/new).\n* To deploy from the command line, you will need the [DigitalOcean `doctl` CLI](https://github.com/digitalocean/doctl/releases).\n\n## Deploying the Function\n\n```\n# clone this repo\ngit clone git@github.com:digitalocean/sample-functions-nodejs-qrcode.git\n```\n\n```\n# deploy the project\n\u003e doctl serverless deploy sample-functions-nodejs-qrcode\nDeploying 'sample-functions-nodejs-qrcode'\n  to namespace 'fn-...'\n  on host 'https://faas-...'\nStarted running npm install --production in sample-functions-nodejs-qrcode/default/qr\nFinished running npm install --production in sample-functions-nodejs-qrcode/default/qr\n...\n\nDeployed functions ('doctl sbx fn get \u003cfuncName\u003e --url' for URL):\n  - qr\n```\n\n## Using the Function\n\n```\n\u003e doctl serverless functions invoke qr/qr -p text:hello\n{\n  \"body\": \"data:image/png;base64,iVB...5CYII=\",\n  \"headers\": {\n    \"content-type\": \"text/html; charset=UTF-8\"\n  }\n}\n```\n\n### Project File Structure\n\nThis app is a stateless single-page web application that generates a [QR code](https://en.wikipedia.org/wiki/QR_code) from text that a user submits.\n\nThis project has the following components:\n\n- A single [`index.html`](./client/index.html) file, which has a field for a visitor to enter some text and click **Submit**.\n- A single JavaScript file [`qr.js`](./packages/default/qr/qr.js) that provides the backend logic for the conversion of text to QR code.\n- A Node package manager file called [`package.json`](./packages/default/qr/package.json), which describes what dependencies the function has.\n\nThe GitHub project has the file structure that App Platform uses to intelligently deploy the project:\n\n- The [`packages`](./packages) directory contains the project's API implementation, and in this example, there's only one API implemented by a single function. The first subdirectory name usually serves as the package qualifier. The next subdirectory, [`qr`](./packages/default/qr), is the name of the function, and the file [`qr.js`](./packages/default/qr/qr.js) contains the logic for that function. The qualified name of the function is also the name of the API it implements which is `default/qr` in this case.\n- The [`client`](./client) directory contains the static web content for the project. In this case, there is just one HTML file and one image. The [`index.html`](./client/index.html) file contains a form with a text box for the user to input the text that will be converted.\n\n### Notes on QR Logic\n\nThe code for the QR action is standard Node.js. It uses an existing Node [library](https://www.npmjs.com/package/qrcode) package for the actual QR code generation.\n\n### Notes on QR Web Content\n\nThe [`index.html`](./client/index.html) file contains the usual markup and logic that you'd write for standard web deployment, with an input form for text. In this case, it calls an API to retrieve a QR code for the form input. This API is implemented by [`qr.js`](./packages/default/qr/qr.js).\n\n### Notes on `package.json`\n\nThe [`package.json`](./packages/default/qr/package.json) file in the [`qr`](./packages/default/qr) directory triggers an automatic build of the action when the function in [`qr.js`](./packages/default/qr/qr.js) is modified.\n\n### Learn More\n\nYou can learn more about Functions and App Platform integration in [the official App Platform Documentation](https://www.digitalocean.com/docs/app-platform/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-nodejs-qrcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fsample-functions-nodejs-qrcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-nodejs-qrcode/lists"}