Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
/ micro Public archive

This was mostly used for Hack Penn. See @zanedb/happy for more info.

Notifications You must be signed in to change notification settings

zanedb/micro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservices

Generates tracking/read receipt URLs.

Routes:

  • POST /read-receipts/new
    • Generates a read receipt URL & stat viewing URL
    • Returns all URLs:
    {
      "url": "https://micro.zane.sh/read-receipts/:key",
      "imageUrl": "https://micro.zane.sh/read-receipts/:key.png",
      "statsUrl": "https://micro.zane.sh/read-receipts/stats/:id"
    }
    
  • GET /read-receipts/:key
    • This tracks a request, or click, for that read receipt URL
    • Returns a 200 OK
  • GET /read-receipts/:key.png
    • This tracks a request, or click, for that read receipt URL & returns a 1x1 tracking pixel image
    • Returns an image file
  • GET /read-receipts/stats/:id
    • This shows all requests, or clicks, to a read receipt URL
    • Keep the id private, otherwise anyone can view your stats
    • Returns all requests:
    {
      "total": 1,
      "clicks": [
        {
          "timestamp": "2018-12-01T01:15:34.693Z",
          "ip": "127.0.0.1",
          "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
          "geo": {
            "ip": "127.0.0.1",
            "type": "ipv4",
            "continent_code": null,
            "continent_name": null,
            "country_code": null,
            "country_name": null,
            "region_code": null,
            "region_name": null,
            "city": null,
            "zip": null,
            "latitude": null,
            "longitude": null,
            "location": {
              "geoname_id": null,
              "capital": null,
              "languages": null,
              "country_flag": null,
              "country_flag_emoji": null,
              "country_flag_emoji_unicode": null,
              "calling_code": null,
              "is_eu": false
            }
          }
        }
      ]
    }
    

Setup:

  1. Create a file in the root directory called .env, containing the following:
# MongoDB instance URI
MONGODB_URI=
# root URL of app in production, ex. https://micro.zane.sh
URL=
# API key for ipstack.com, used for geolocating
IPSTACK_API_KEY=
# optional, leave blank for 3000
PORT=
# optional, leave blank unless using a proxy (i.e. Nginx)
TRUST_PROXY=
  1. Install packages:
yarn
  1. Run!
yarn start
# or, for development:
yarn dev

About

This was mostly used for Hack Penn. See @zanedb/happy for more info.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published