<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Node.js &#8211; CS@Worcester</title>
	<atom:link href="https://cs.worcester.edu/category/node-js/feed/" rel="self" type="application/rss+xml" />
	<link>https://cs.worcester.edu</link>
	<description>Worcester State University Computer Science Department</description>
	<lastBuildDate>Sun, 13 Dec 2020 16:03:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<site xmlns="com-wordpress:feed-additions:1">236835116</site>	<item>
		<title>It’s Easy to Break Promises</title>
		<link>https://theintrospectivethinker529047368.wordpress.com/2020/12/13/its-easy-to-break-promises/</link>
		
		<dc:creator><![CDATA[David MacDonald]]></dc:creator>
		<pubDate>Sun, 13 Dec 2020 16:03:56 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[CS-343]]></category>
		<category><![CDATA[CS@Worcester]]></category>
		<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Week-14]]></category>
		<guid isPermaLink="false">http://theintrospectivethinker529047368.wordpress.com/?p=181</guid>

					<description><![CDATA[Context I’m currently writing a Node.js package for a wrapper I’m calling a curfew-promise. It’s simpler than I thought, but it is still worth doing in my opinion. The package exports a single function that returns a promise. The promise…  <p class="more-link"><a href="https://theintrospectivethinker529047368.wordpress.com/2020/12/13/its-easy-to-break-promises/">Continue reading <span class="meta-nav">→</span></a></p>]]></description>
										<content:encoded><![CDATA[<h3>Context</h3>
<p>I&#8217;m currently writing a Node.js package for a wrapper I&#8217;m calling a <a rel="noreferrer noopener" href="https://github.com/DavidMacDonald11/curfew-promise" >curfew-promise</a>. It&#8217;s simpler than I thought, but it is still worth doing in my opinion. The package exports a single function that returns a promise. The promise has &#8220;3&#8221; parameters with the function header being: <code>(curfew, func, ...args)</code>. The promise then performs <code>func</code> asynchronously (so <code>func</code> itself can be sync or async). It passes <code>...args</code> to that function when it&#8217;s called. Lastly, the key idea here is that if <code>func</code> takes longer than <code>curfew</code> milliseconds to complete, the wrapper will become a rejected promise. </p>
<p>At first, it seemed like a tough task, until I discovered the built in <code>Promise.race()</code> function which creates a promise which we can refer to as the <code>racePromise</code>. That function then also takes in multiple other promises. Whichever passed in promise resolves or rejects first, its value is then passed onto <code>racePromise</code>. I can achieve my <code>curfewPromise</code> then by creating one promise that runs <code>func</code> and one that rejects after <code>curfew</code> has passed. Whichever finishes first becomes the value of the promise the function returned. The only way I&#8217;ve found to pause an async operation in JavaScript is via <code>await new Promise((resolve) =&gt; { setTimeout(resolve, duration); });</code> This line, when placed into any async function, will pause operation until <code>duration</code> has passed. You can also remove the redundant brackets and shrink it down to <code>await new Promise(r =&gt; setTimeout(r, duration));</code> , but I prefer to be more consistent. </p>
<h3>JavaScript is NOT Multi-Threaded</h3>
<p>JavaScript runs in a single thread. The way it pretends to be multi-threaded is by switching back and fourth between tasks to give all of them a little bit of time until they all finish. JavaScript is also an interpreted language. This means while trying to test my package, I had a lot of trouble. I spent a few hours trying to understand what was going on and now that I have, I&#8217;m going to write about it to save you trouble. </p>
<h4>The Code</h4>
<p>I was completely convinced that JavaScript itself was just broken. Here is my package, at least in its current state: (If you&#8217;d like to use this or see the modern version, check the <a rel="noreferrer noopener" href="https://github.com/DavidMacDonald11/curfew-promise" >GitHub page</a> (soon to also be on npmjs.com))</p>
<pre class="brush: jscript; title: ; notranslate">
module.exports = (curfew, func, ...args) =&gt; {
    let waitId;

    async function wait() {
        await new Promise((resolve) =&gt; { waitId = setTimeout(resolve, curfew); });
        return Promise.reject(new Error(&quot;Curfew of &quot; + curfew + &quot;ms have elapsed.&quot;));
    }

    async function perform() {
        const value = await func(...args);
        if(waitId) clearTimeout(waitId);
        return Promise.resolve(value);
    }
    
    return Promise.race([wait(), perform()]);
}
</pre>
<p><code>wait()</code> creates a promise (using async notation, since from what I&#8217;ve read that is more ideal than direct promise notation) which waits until <code>curfew</code> has passed, which then rejects with a useful stack trace message. You&#8217;ll notice I&#8217;m also storing <code>waitId</code>, which is the ID of the <code>setTimeout</code> call. This way, if <code>func</code> finishes before curfew, I can cancel the timeout and not waste performance. I&#8217;ll also be looking into ways to create cancellable promises. I&#8217;m aware there are already packages that do this, but I think I&#8217;ll benefit from doing it by hand. I could make <code>wait()</code> a synchronous function that simply returns a waiting promise that calls <code>setTimeout</code> for <code>reject</code>, but I chose making it like this because then it matches the form of <code>perform()</code> (two async functions), and it allows me to write two lines that are visibly neat rather than trying to force everything into one line.</p>
<p><code>perform()</code> creates a promise that waits until <code>func</code> is finished. Once it is, it&#8217;ll attempt to stop the waiting promise. If the promise is still waiting, it&#8217;ll stop it. If the promise has already rejected, it will do nothing. Then, the function returns a resolved promise with the value from <code>func</code>. I chose to write <code>return Promise.resolve(value)</code> instead of <code>return value</code>, which I understand to be the same thing, for consistency once again, and I think it makes the code more readable overall. </p>
<p>Lastly, I am creating the promises off of these functions and making them race. The function returns a promise that resolves or rejects whenever the first of the two &#8211; <code>wait()</code> and <code>perform()</code> &#8211; finish.</p>
<h4>The Problem</h4>
<p>I was able to narrow down the problem to this line: </p>
<pre class="brush: jscript; first-line: 10; title: ; notranslate">
        const value = await func(...args);
</pre>
<p>All of my tests had worked until I did something like the following:</p>
<pre class="brush: jscript; title: ; notranslate">
const curfewPromise = require(&quot;./index&quot;);

// Broken Promise 1
console.log(curfewPromise(10000, async () =&gt; { 
    for(i = 0; i &lt; 1000000; i += .001);
}));

// Broken Promise 2
console.log(curfewPromise(10000, async () =&gt; { while(true); }));
</pre>
<p>I found that for broken promise 1, despite the fact that curfewPromise returns a promise, it wouldn&#8217;t finish until the for loop finished. Even if I set the curfew to 0, it would take until the for loop completed. Broken promise 2 would never even end. I purposefully wanted to test these edge cases, where something would actually take a long time for ever (a good example for why I want the ability to cancel a promise). </p>
<p>The problem that I realized so frustratingly last evening is, and say it with me, <em>JavaScript is <strong>NOT</strong> multi-threaded</em>. Yes, when you run an asynchronous function, you can do other things in the meantime while it finishes. But as far as I can tell, JavaScript does this on a line by line basis. If you have a single line that is very slow or infinite, JavaScript will start running it, as that&#8217;s how asynchronous functions work, and then after some progress, it will move on. The thing is, you <strong>can&#8217;t</strong> make progress until that line ends. In the case of an infinite while loop, it will <strong>never</strong> end. In the case of a very slow one-line for loop, it can&#8217;t move on until the for loop is finished. <code>Promise.race()</code> cannot return a promise, so <code>curfewPromise</code> cannot return a promise. Once the for loop actually ends, it&#8217;s a gamble to decide which non-neutral-state promise will be chosen to have won the race. (Also keep in mind when using very small <code>curfews</code>, there is internal delay and it may not behave how you expect). </p>
<h3>Conclusion</h3>
<p>JavaScript is not multi-threaded. Make sure you keep that in the back of your mind. I was inadvertently testing for a case that shouldn&#8217;t ever even happen. While it was frustrating trying to figure out what was wrong, I still think that this kind of struggle is necessary in both life and learning. I always learn the most in coding when I&#8217;m trying to find out how to do something and I have 20 tabs open. </p>
<p>While this is a simple package that does something many developers probably can do easily, I still want to spend time making it and even upload it to npm. I think even though it&#8217;s simple, the function still helps clean up syntax to improve readability and reduce lines. I also think making it an external package helps to reduce complexity in your projects and helps me use it in multiple projects. Maybe someone can also look at it for help when learning how promises work. </p>
<p>At the end of the day, promises and asynchronous functions are an incredibly valuable tool in JavaScript and the illusion of multiple threads helps in most situations. Just be careful to not break your promises. </p>

<p class="syndicated-attribution"><em>From the blog <a href="https://theintrospectivethinker529047368.wordpress.com">CS@Worcester – The Introspective Thinker</a> by <a href="https://cs.worcester.edu/author/0/" title="Read other posts by David MacDonald">David MacDonald</a></em> and used with permission of the author. All other rights reserved by the author.</p>]]></content:encoded>
					
		
		<enclosure url="https://2.gravatar.com/avatar/8673d52cf7b1c89e4cc8d888be204ba4?s=96&#038;d=identicon&#038;r=G" length="0" type="" />

		<post-id xmlns="com-wordpress:feed-additions:1">14611</post-id>	</item>
		<item>
		<title>Running Bash Commands in Node.js</title>
		<link>https://theintrospectivethinker529047368.wordpress.com/2020/12/06/running-bash-commands-in-node-js/</link>
		
		<dc:creator><![CDATA[David MacDonald]]></dc:creator>
		<pubDate>Mon, 07 Dec 2020 00:52:01 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[CS-343]]></category>
		<category><![CDATA[CS@Worcester]]></category>
		<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Week 13]]></category>
		<guid isPermaLink="false">http://theintrospectivethinker529047368.wordpress.com/?p=161</guid>

					<description><![CDATA[Disclaimer: This is not explicitly a “guide”. There are far better resources available on this topic; This is simply a discussion about the child_process module. Anecdotal Background I’ve been in the process of creating programs to automate the running of…  <p class="more-link"><a href="https://theintrospectivethinker529047368.wordpress.com/2020/12/06/running-bash-commands-in-node-js/">Continue reading <span class="meta-nav">→</span></a></p>]]></description>
										<content:encoded><![CDATA[<h4>Disclaimer:</h4>
<p>This is not explicitly a &#8220;guide&#8221;. There are far better resources available on this topic; This is simply a discussion about the <code>child_process</code> module. </p>
<h3>Anecdotal Background</h3>
<p>I&#8217;ve been in the process of creating programs to automate the running of my Minecraft Server for my friends and I. In that process, I&#8217;ve created a functional system using a node server, a C++ server, and a lot of bash files. While it works, I can&#8217;t be sure there aren&#8217;t bugs without proper testing. Trust me, nothing about this project has has &#8220;doing it properly&#8221; in mind. </p>
<p>When learning front-end JavaScript, I recall hearing that it can&#8217;t modify files for security reasons. That&#8217;s why I was using a C++ server to handle file interactions. Little did I realize node can easily interact with files and the system itself. Once I have the time, I&#8217;m going to recreate my set up in one node server. The final &#8220;total&#8221; set up will involve a heroku node server, a local node server, and a raspberry pi with both a node server (for wake on lan) as well as an nginx server as a proxy for security for the local node servers.</p>
<h3>Log</h3>
<p>As a bit of a prerequisite, I&#8217;ve been using a basic module for a simple improvement on top of <code>console.log</code>. I create a <code>log/index.js</code> file (which could simply be <code>log.js</code>, but I prefer having my <code>app.js</code> being the only JavaScript file in my parent directory. The problem with this approach, however, is that you end up with many <code>index.js</code> files which can be hard to edit at the same time). </p>
<p>Now, depending on what I need for my node project I might change up the actual function. Here&#8217;s one example: </p>
<pre class="brush: jscript; title: ; notranslate">
module.exports = (label, message = &quot;&quot;, middle = &quot;&quot;) =&gt; {
    console.log(label + &quot; -- &quot; + new Date().toLocaleString());
    if(middle) console.log(middle);
    if(message) console.log(message);
    console.log();
}
</pre>
<p>Honestly, all my log function does is print out a message with the current date and time. I&#8217;m sure I could significantly fancier, but this has proved useful when debugging a program that takes minutes to complete. To use it, I do:</p>
<pre class="brush: jscript; gutter: false; title: ; notranslate">
// This line is for both log/index.js and log.js
const log = require("./log"); 

log("Something");
</pre>
<p>Maybe that&#8217;ll be useful to someone. If not, it provides context for what follows&#8230;</p>
<h3>Exec</h3>
<p>I&#8217;ve created this as a basic test to see what it&#8217;s like to run a minecraft server from node. Similar to <code>log</code>, I created an <code>exec/index.js</code>. Firstly, I have: </p>
<pre class="brush: jscript; title: ; notranslate">
const { execSync } = require("child_process");
const log = require("../log");
</pre>
<p>This uses the log I referenced before, as well as <code>execSync</code> from node&#8217;s built in <code>child_process</code>. This is a synchronous version of <code>exec</code> which, for my purposes, is ideal. Next, I created two basic functions:</p>
<pre class="brush: jscript; first-line: 15; title: ; notranslate">
module.exports.exec = (command) =&gt; {
    return execSync(command, { shell: &quot;/bin/bash&quot; }).toString().trim();
}

module.exports.execLog = (command) =&gt; {
    const output = this.exec(command);
    log(&quot;Exec&quot;, output, `$ ${command}`);
    return output;
}
</pre>
<p>I create a shorthand version of <code>execSync</code> which is very useful by itself. Then, I create a variant that also creates a log. From here, I found it tedious to enter multiple commands at a time and very hard to perform commands like <code>cd</code>, as every time <code>execSync</code> is ran, it begins in the original directory. So, you would have to do something along the lines of <code>cd directory; command</code> or <code>cd directory &amp;&amp; command</code>. Both of which become incredibly large commands when you have to do a handful of things in a directory. So, I created scripts:</p>
<pre class="brush: jscript; first-line: 4; title: ; notranslate">
function scriptToCommand(script, pre = &quot;&quot;) {
    let command = &quot;&quot;;

    script.forEach((line) =&gt; {
        if(pre) command += pre;
        command += line + &quot;\n&quot;;
    });

    return command.trimEnd();
}
</pre>
<p> I created them as arrays of strings. This way, I can create scripts that look like this: </p>
<pre class="brush: jscript; gutter: false; title: ; notranslate">
[
    "cd minecraft",
    "java -jar server.jar"
]
</pre>
<p>This seemed like a good compromise to get scripts to look almost syntactically the same as an actual bash file, while still allowing me to handle each line as an individual line (which I wanted to use so that when I log each script, each line of the script begins with <code>$</code> followed by the command). Then, I just have: </p>
<pre class="brush: jscript; first-line: 25; title: ; notranslate">
module.exports.execScript = (script) =&gt; {
    return this.exec(scriptToCommand(script));
}

module.exports.execScriptLog = (script) =&gt; {
    const output = this.execScript(script);
    log(&quot;Exec&quot;, output, scriptToCommand(script, &quot;$ &quot;));
    return output;
}
</pre>
<h4>Key Note:</h4>
<p>When using the <code>module.exports.foo</code> notation to add a function to a node module, you don&#8217;t need to create a separate variable to reference that function inside of the node module (without typing <code>module.exports</code> every time). You can use the <code>this</code> keyword to act as <code>module.exports</code>. </p>
<h3>Conclusion</h3>
<p>Overall, running bash, shell, or other terminals in node isn&#8217;t that hard of a task. One thing I&#8217;m discovering about node is that it feels like every time I want to do something, if I just spend some time to make a custom module, I can do it more efficiently. Even my basic <code>log</code> module can be made far more complex and save a lot of keystrokes. And that&#8217;s just a key idea in coding in general. </p>
<p>Oh, and for anyone wondering, I can create a <code>minecraft</code> folder and place in the <code>sever.jar</code> file. Then, all I have to do is:</p>
<pre class="brush: jscript; title: ; notranslate">
const { execScriptLog } = require("./exec");

execScriptLog([
    "cd minecraft",
    "java -jar server.jar"
]);
</pre>
<p>And, of course, set up the server files themselves after they generate. </p>

<p class="syndicated-attribution"><em>From the blog <a href="https://theintrospectivethinker529047368.wordpress.com">CS@Worcester – The Introspective Thinker</a> by <a href="https://cs.worcester.edu/author/0/" title="Read other posts by David MacDonald">David MacDonald</a></em> and used with permission of the author. All other rights reserved by the author.</p>]]></content:encoded>
					
		
		<enclosure url="https://2.gravatar.com/avatar/8673d52cf7b1c89e4cc8d888be204ba4?s=96&#038;d=identicon&#038;r=G" length="0" type="" />

		<post-id xmlns="com-wordpress:feed-additions:1">14590</post-id>	</item>
		<item>
		<title>A Strange Way to Use Get Requests</title>
		<link>https://theintrospectivethinker529047368.wordpress.com/2020/11/08/a-strange-way-to-use-get-requests/</link>
		
		<dc:creator><![CDATA[David MacDonald]]></dc:creator>
		<pubDate>Mon, 09 Nov 2020 01:39:30 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[CS-343]]></category>
		<category><![CDATA[CS@Worcester]]></category>
		<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Week 9]]></category>
		<guid isPermaLink="false">http://theintrospectivethinker529047368.wordpress.com/?p=88</guid>

					<description><![CDATA[Strap in because this post is going to get very anecdotal. Backstory I have a history of running Minecraft servers for my friends and I. A few years ago, I learned how to port-forward a locally hosted server and use…  <p class="more-link"><a href="https://theintrospectivethinker529047368.wordpress.com/2020/11/08/a-strange-way-to-use-get-requests/">Continue reading <span class="meta-nav">→</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Strap in because this post is going to get very anecdotal. </p>
<h2>Backstory</h2>
<p>I have a history of running Minecraft servers for my friends and I. A few years ago, I learned how to port-forward a locally hosted server and use it to play on. While it&#8217;s not the most secure thing in the world technically, it works really well and it&#8217;s produced a lot of fun. For whatever reason, I was thinking about it again recently. </p>
<p>When I&#8217;m out of school, that&#8217;s usually when we play. I&#8217;ve slowly been learning more and more. I&#8217;m currently at the point where I can make intermediate datapacks for the game and use shell/bash/batch scripts to run the server. Over the summer for instance I created a shell script to run the server, back it up, and reload it if it crashes. </p>
<p>There&#8217;s still one major problem with my servers, however. I need to manually turn on one of my computers and run it. Then that computer has to stay on until I want the server off. It might waste power if no one is using it (also increasing the risk of the world becoming corrupted) and it&#8217;s just slowly going to wear out my hardware. </p>
<p>Recently, I remembered that I had two old laptops. Unfortunately, the newer one didn&#8217;t have a power cord. So I broke my way in and took out the ram, hard drive, and wifi card. Then I swapped those components into the other laptop. Lastly, I installed Lubuntu onto it. It works surprisingly well. I then set up NoMachine so I can remote into the machine without having it in front of me. The BIOS supports wake on LAN so I took a few hours to get that working. Now, I can leave that laptop plugged in next to my router and send a signal over the internet to wake it up. While the router blocks the magic packet required on ports 7 and 9, a simple port forward allows wake on LAN to work from anywhere. I would definitely not recommend that for most scenarios, but until I find myself the victim of attacks on my router, I think I&#8217;ll take my chances. </p>
<p>Now, my goal has been to create programs that run all the time that laptop is running to be able to receive requests to launch Minecraft servers. I&#8217;ll work out a script later for handling crashes and such, as well as a datapack for automatically stopping the server when no one has been online in 30 minutes or so. So I started work on a node server. </p>
<h2>Node.js</h2>
<p>While I am learning about node in my CS-343 course, I have already taken the Web Developer Bootcamp by Colt Steele on Udemy and I highly recommend it. This is the basis of my server so far:</p>
<pre class="brush: jscript; title: ; notranslate">
const express = require("express");
const app = express();

const server = 
app.listen(process.env.PORT, process.env.IP, function() {
     console.log("The server has started.");
});

var minecraft_server1_on = false;

app.get("/minecraft/server1/start", function(req, res) {
     res.send("Turning on the server…\n");
     minecraft_server1_on = true;
});

app.get("/minecraft/server1/ping", function(req, res) {
     res.send(minecraft_server1_on);
});

app.get("/minecraft/server1/declare_off", function(req, res) {
     res.send("The server is off.\n");
     minecraft_server1_on = false;
});

app.get("/exit", function(req, res) {
     res.send("Exiting…\n");
     server.close();
});

app.get("*", function(req, res) {
     res.send("The server is running.\n");
});
</pre>
<p>Now, I&#8217;m <strong>certain</strong> that I&#8217;m making mistakes and doing things in a strange way. It definitely is not in a state I would use for anything other than a private server, and even then I&#8217;m still working on it. </p>
<p>Here&#8217;s the important parts. It&#8217;s an express app with a few get routes. I&#8217;m running this server from a bash script using nohup so that it can simply run in the background while the pc runs. However, I want to be able to stop the server from another bash script without using process ID&#8217;s so I don&#8217;t risk closing the wrong thing. While I was considering my options, I thought of something really interesting. I can use the <code>curl</code> command to perform a basic get request in a bash script. So I created a route <code>/exit</code> that when requested, it shuts down the server. </p>
<p>It&#8217;s incredibly simple and there are definitely ways around it, but I never even thought of using get requests in this way. There is information in the requesting of a web page, excluding the normal stuff. Just the fact that a request occurred can be useful. What this means is I can check if the server is running by pinging most routes. I can also <strong>both</strong> send and receive boolean data without any real complexity. Once again, I&#8217;m sure this violates some design principle. However, for something like this that is meant to be mostly casual and private, why should I need to set up proper post routes and databases when I can use this.</p>
<p>My method of turning on a Minecraft server now; I store the state in a variable in the node server. This is fine because when this server stops, all other servers should have stopped so I don&#8217;t need a database. Then, by pinging certain routes, I can turn a Minecraft server on, check if it&#8217;s on, and declare that I have turned it off somewhere else. The node server can maintain the state of Minecraft servers (I can possibly run multiple on different ports) as well as handle inside and outside tracking. </p>
<p>Keep in mind again, I&#8217;m looking for the easiest way I know how to make this work right now, not the <strong>best</strong> way to do it. So from here, I had no idea how to make the node server actually start a Minecraft server. I know how to run one from a bash command though. So I created a C++ program that will also run all the time. It can periodically check the status of the node server. For instance, if I send a request to the node server to turn on a Minecraft server, the C++ program can detect that change by running <code>system("curl <a href="http://localhost/" rel="nofollow">http://localhost:PORT/minecraft/server1/ping</a>");</code> Once again, I&#8217;m using a UNIX command in C++ rather than using a wrapper library for curl because it was an easier solution for me. The node server can then return true or false. In fact, the C++ server won&#8217;t directly run the command. It will run a bash script that runs the command and stores output into a file. C++ can then read the file and get the result. </p>
<p>I&#8217;m currently still in the process of making this work. After this, I&#8217;ll make another node server hosted on Heroku that has a nice front end to allow myself and other people to request the laptop to wake on LAN, and then directly interact with those local node server. I may even make a Discord bot to allow people to simply message in chat to request the server to turn on. </p>
<h2>Conclusion</h2>
<p>Once again, I do not recommend anyone actually does this the way I have. However, the whole point of coding is to make a computer do what you want it to. If you can hide the get requests behind authorization (which I will probably do) as well as fix any other issues, this could be useful. It&#8217;s not even specifically about using get requests in this way. Abstract out and realize that it&#8217;s possible to do something in a way you never thought of, and it&#8217;s possible to use something in a way you never have. Consider what you know and explore what&#8217;s possible. Figure out whether or not it&#8217;s a good practice based on what problems you run into. I think that&#8217;s one of the best ways to learn and if you can find a functional example to fixate on, the way I have, you can find yourself learning new things incredibly quickly.  </p>

<p class="syndicated-attribution"><em>From the blog <a href="https://theintrospectivethinker529047368.wordpress.com">CS@Worcester – The Introspective Thinker</a> by <a href="https://cs.worcester.edu/author/0/" title="Read other posts by David MacDonald">David MacDonald</a></em> and used with permission of the author. All other rights reserved by the author.</p>]]></content:encoded>
					
		
		<enclosure url="https://2.gravatar.com/avatar/8673d52cf7b1c89e4cc8d888be204ba4?s=96&#038;d=identicon&#038;r=G" length="0" type="" />

		<post-id xmlns="com-wordpress:feed-additions:1">14495</post-id>	</item>
	</channel>
</rss>
