This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
var bodyParser = require('body-parser'); | |
var uuid = require('uuid'); | |
var students = []; | |
// parse application/json | |
app.use(bodyParser.json()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var url = require('url'); | |
var urlAPI = "http://jsonplaceholder.typicode.com/comments"; | |
var urlParts = url.parse(urlAPI); | |
var options = { | |
protocol: urlParts.protocol, | |
hostname: urlParts.host, | |
port: urlParts.port || 80, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var readline = require('readline'); | |
var net = require('net'); | |
var port = process.env.CHATPORT || 8090; | |
var client = new net.Socket(); | |
client.connect(port, '127.0.0.1', function() { | |
console.log('Connected'); | |
}); | |
client.setEncoding("utf8"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var client = new net.Socket(); | |
client.connect(9090, "127.0.0.1", function(){ | |
console.log("connected"); | |
}); | |
var times = 5; | |
var interval = setInterval(function(){ | |
if(!times){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var server = net.createServer(function(socket){ | |
socket.on('data', function(data){ | |
console.log('data received', data.toString()); | |
socket.write(data, function(){ | |
console.log("data re-sended"); | |
}) | |
}); | |
}).listen(9090); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var parameters = process.argv.slice(2, process.argv.length); | |
var timeOut = 2000; | |
console.log(parameters) | |
if(parameters.length == 1 && parameters[0] == "help"){ | |
printHelp(); | |
} | |
if(parameters.length != 2){ |
NewerOlder