Here is the link to the time API on my site, when the server is running it will report the time in three different formats.
This is what the url looks like to access it: https://noahdorazio.com/api/time
I kept the micro service my site offers simple right now: It tells the time. Keeping the service simple did not result in a smooth implementation and process.
First, I made sure that node.js was installed on my server.

It was.
const express = require("express");// loads express library
const app = express();//creates app object, an app object is sort of like the center of the server, recieving webrequests and how to deal with them.
app.get("/api/time", (req, res) => {// GET route, when someone requests "noahdorazio.com/api/time", the function within the brackets below will run
const now = new Date(); // accesses the server's system clock, defines it as now
res.json({
utc: now.toISOString(),//time from server's clock as ISO format
local: now.toLocaleString(),//time as local conputer's
unix: now.getTime()//time as milliseconds
});
});
app.listen(3000, "0.0.0.0", () => {//opens network port 3000, and 0.0.0.0 means it will accept connections from anywhere
console.log("Time API running on <http://127.0.0.1:3000>");
});
I messed up the Nginx reverse proxy rule and added a backslash that took me a long time to troubleshoot what was wrong.
location /api/ { proxy_pass http://127.0.0.1:3000/; THIS IS THE BACK SLASH THAT I HAD TROUBLE FINDING // sends the requests from api to the backend server
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_buffering off;
From what I understand Nginx is serving as an air gap for outside requests to the API. It gets the requests, then routes internally to port 3000, and then from there and then returns the results.