I’d like to make web app with programming tasks and I’m curious how could I add code editor with compiler (like here on Free Code Camp where you have editor for every task with syntax highlight and running tests to check if solution is right) to my app. I could just compile code on the server and get the results but there might be security issues with this approach.
Could you help me find a better way?
Well, freeCodeCamp is open source, so you are more than welcome to dig through the codebase and see how it all ticks!
IIRC there are open source, web based code editors like the ones FCC and Codepen use.
I think Codepen uses CodeMirror.
You might want to listen to some of the early Codepen Radio podcasts as well, as they discuss many of their implementation details, including security stuff. Plus it’s fascinating!
Thanks a lot! You’re right, I’ll check it out!
A quick scan of the freeCodeCamp repo suggests they are using CodeMirror too: GitHub Search: FCC & CodeMirror