[NodeJS] WebSocket-based NodeJS on-line webide and online compilation

Source: Internet
Author: User

A long time ago, I wanted to make an online IDE, a nodejs of the previous period, made a simple version

Login, registration, Code Editor (highlighting, auto-Lenovo), cloud compilation and other functions are now completed.

Front end I mainly use bootstrap, Codemirror

The back end is mainly Nodejs

Compiler is g++

All stations are fully static, so requests are AJAX simulations

Below is the source code of Server.js

Other can be coding to view the project

Https://git.coding.net/leeli73/CorCPP_Online_IDE.git

Because many of the files in the naming, I used-and coding in the special characters can not be a file name, so the project Www.zip is the site's front-end code

Server.js is a server script

There are a lot of questions, I hope the jackpot will help me find bugs and perfect features

varWebsocketserver = require (' WS '). Server, WSS=NewWebsocketserver ({port:88}); Wss.on (' Connection ',function(WS) {Console.log (' Client Connected '); Ws.on (' Message ',function(message) {console.log (message);    Responsejson (message); });});functionResponsejson (str) {varData =json.parse (str); if(Data.type = = "Code") {Response_code (data.data); }    Else if(Data, Type = = "Get")    {    }}functionResponse_code (Code) {varFS = require ("FS"); Fs.writefile (' Gcc\code\code.txt ', code,function(err) {if(err) {returnConsole.error (ERR); }}) Fs.readfile (' Gcc\code\code.txt ',function(err, data) {if(err) {returnConsole.error (ERR); } console.log ("DATA is:" +data.tostring ()); })    varcmd = require ("Node-cmd"); /*cmd.get (' c:\\users\\leeli\\documents\\visual Studio 2017\\projects\\server\\server\\gcc\\check.exe C:\\Users\ \leeli\\documents\\visual Studio 2017\\projects\\server\\server\\gcc\\code\\code.txt ', function (data) {Console    . log (data); });*/Cmd.run (' E:\server\server\gcc\check.exe E:\server\server\gcc\code\code.txt ');}

[NodeJS] WebSocket-based NodeJS on-line webide and online compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.