vitorvigano
vitorvigano

Reputation: 707

Processing js server side

I need to know how is the best way to solve the problem below:

I have an online editor, where the user write a js code to solve some problem, like a challenge. So, I need to get this code, and proccess it in a server, to check if the code was written correctly, comparing the results.

Do I need to call a js shell in server side or something like this?

Upvotes: 0

Views: 216

Answers (2)

Sergey Snegirev
Sergey Snegirev

Reputation: 1026

Google for JavaScript interpreter, there are quite a few.

Upvotes: 0

jgillich
jgillich

Reputation: 76369

Running any code written by the user on your server would be a great security issue.

Instead, run the code on the client with eval(). Then send the result (like if the user solved it) to your server.

Upvotes: 1

Related Questions