r/shittyprogramming • • Dec 06 '17

Server-side JavaScript code?

Hi I'm trying to make Server-sided JavaScript code. Can Someone help me?

4 Upvotes

16 comments sorted by

26

u/[deleted] Dec 06 '17

Is this a joke?

Node.js, they just released a new LTS

16

u/RTracer Dec 06 '17

Check the subreddit you're on.

20

u/[deleted] Dec 06 '17

I saw the subreddit, that's why I was confused. This is just kinda noob question, not really funny.

Ps I'm a Node diehard DON'T YOU DARE MAKE FUN OF MY TOOL REEEEEEEEE

2

u/07025 Dec 06 '17 edited Dec 06 '17

I don't like Node.js. Hurts my eyes. It's like Basic pseudocode, Rick and Morty, and Java had a baby or something like that

EDIT: To add more flavor to my statement... In Episode 2 of Rick and Morty Season 1, it has been stated that Node.js is an unsafe language due to it being built on JavaScript, hence being developed using Java.

1

u/LowB0b Dec 07 '17

Node.js is an unsafe language due to it being built on JavaScript

Not sure if you're trolling but damn

0

u/[deleted] Dec 06 '17

[deleted]

1

u/07025 Dec 06 '17

Better than taking advice from official documentation.

2

u/FawnWig Jan 05 '18

VBScript Runtime for Linux

46

u/[deleted] Dec 06 '17

Dude. ASP.NET has been doing this for years. Just add the runat attribute to the script tag.

<script runat="server"> // Put code here </script>

Just be careful to not use alert(), otherwise someone will have to log into the server to click "OK".

Good luck!

9

u/xhable Dec 06 '17

You joke, we had a legacy asp.net web forms app at my company that was filled with messageboxes for debugging. The server was filled with boxes saying "I'm here" or "X is 27". Hilarious if not depressing.

0

u/[deleted] Dec 06 '17

[deleted]

2

u/xhable Dec 06 '17

Long gone usefully!

21

u/iluuu Dec 06 '17

0. Open any browser on your server.

Done. You’re now running JavaScript on your server.

12

u/jesse_dev Dec 06 '17

tldr; Server-Side CSS is the next big thing. If you didn't know, Javascript is slowly being replaced by CSS. For example, onmouseover() has been replaced by :hover in CSS. It's just a matter of time before everyone starts developing ssscss, aka "Sassy Sharp"

3

u/skylarmt Dec 11 '17

Well, CSS3+HTML5 is Turing-complete... Link

1

u/jesse_dev Dec 11 '17

haha. TIL

11

u/skylarmt Dec 06 '17 edited Dec 06 '17

It's quite simple. Start with a regular Apache/PHP install, then install Java on the server. Upload a JavaScript file that generates your HTML and stores it in a var. Next write some Java code that reads your JavaScript file and executes it with javax.script.ScriptEngine. Dump the contents of your var from ScriptEngine with System.out.println(). Now in your index.php, write:

<?php
$site = `java -jar MySite.jar`;
echo $site;

If you want an extra layer of security, run the jar file from a Python script and change your PHP to use python MySite.py instead.

2

u/[deleted] Jan 10 '18

Use JQuery.