So, if money were on the line and you had to return the current date (dynamically) from some publicly accessible endpoint, starting right this moment, how long would it take you?
Seconds? Minutes? Dozens of minutes?
If you're feeling brave, time yourself and post the results here.
- Created project
- Write a function to return new Date()
- Drop a text
- Wire up the text to the function
- Set the function to run on page load and clicked deploy button
Decided I wanted to add an API endpoint as well, that took about 10 seconds: https://cc70f0cd60da3c80.dynaboard.app/httpEndpoint1
Added an endpoint and configured it to run a function to return new Date() and clicked deployed
Also figured I wanted all of you to be able deploy your own apps that shows current date, that took about 1 minute:
- Exported the project to clipboard
- Created a new github repo https://github.com/nsaechao/current-date
- Added a dynaboard.yml file and pasted content from clipboard.
- Went back to my app and added a button 'Fork" to redirect to https://dynaboard.new/nsaechao/current-date
- Redeployed the app
Disclaimer: I work for Dynaboard and Dynaboard is a low-code app builder.
Cause if I do, this is like 30 seconds of time for PHP:
echo date();
?>
curl -A Mozilla -s --head "https://google.com/"|grep -Ei ^date
or curl -A Mozilla -s --head "https://facebook.com/"|grep -Ei ^date # since they are using soon to be NTPv5
Does it have to be a site I stood up? If so the same could be accomplished installing any web server with a blank or default page. This also assumes I have NTP in sync.Another option would be to enable anonymous ssh and then:
ssh anon@some.host 'date;cal -3'
Or just output that via cron to a text file served by a simple web server with cache controls that prevent caching more than a few seconds.Time results: Using curl took a couple seconds but I could make it an alias. If I had to install a web server on a VM somewhere and didn't already have one it might take 10 to 20 seconds. Or I could forego the web server and just make Chronyd public as there were no client restrictions mentioned.
Probably less than 2minutes total for a rest endpoint
Took me ~30 seconds, I forgot how netcat works.