From: Ardis Lu Date: Sat, 18 Sep 2021 20:43:58 +0000 (-0700) Subject: Add UUID worker X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=8c4fef2ba961aba954fac8b0ab7b42fd670c288b;p=cloudflare-workers Add UUID worker --- diff --git a/package.json b/package.json index 468272e..db369bd 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "cors", "pwned", "qr", - "ip" + "ip", + "uuid" ] } diff --git a/uuid/index.js b/uuid/index.js new file mode 100644 index 0000000..fa0eb51 --- /dev/null +++ b/uuid/index.js @@ -0,0 +1,3 @@ +addEventListener('fetch', event => { + event.respondWith(new Response(crypto.randomUUID())); +}) diff --git a/uuid/package.json b/uuid/package.json new file mode 100644 index 0000000..5524005 --- /dev/null +++ b/uuid/package.json @@ -0,0 +1,19 @@ +{ + "name": "uuid", + "version": "0.1.0", + "description": "Cloudflare Worker which returns a random version 4 UUID.", + "private": true, + "main": "index.js", + "scripts": { + "login": "wrangler login", + "preview": "wrangler preview", + "build": "wrangler build", + "publish": "wrangler publish" + }, + "author": "Ardis Lu", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/ardislu/cloudflare-workers.git" + } +} diff --git a/uuid/wrangler.toml.example b/uuid/wrangler.toml.example new file mode 100644 index 0000000..0f5ecb7 --- /dev/null +++ b/uuid/wrangler.toml.example @@ -0,0 +1,5 @@ +name = 'uuid' +type = 'javascript' +account_id = '' +workers_dev = true +route = 'example.com/*'