Skip to main content

node.js

AN EXAMPLE: WEBSERVER

This simple web server written in Node responds with "Hello World" for every request.
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
To run the server, put the code into a file example.js and execute it with the node program from the command line:
% node example.js
Server running at http://127.0.0.1:1337/
Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:
var net = require('net');

var server = net.createServer(function (socket) {
  socket.write('Echo server\r\n');
  socket.pipe(socket);
});

server.listen(1337, '127.0.0.1');

Comments

  1. Sữa ong chúa là gì, sữa ong chúa royal jelly 1000mg giúp cải thiện bổi bổ sức khỏe.Thuốc hỗ trợ điều trị ung thư sẽ giúp bạn điều trị căn bệnh ung thư hiệu quả hơn. Bạn đang bị rụng tóc, thuốc mọc tóc natrol biotin giúp bạn có mái tóc mượt mà và bóng mượt hơn. Nứt gót chân có nguy hiểm không? kem trị nứt gót chân của chúng tôi sẽ giúp bạn trị bệnh nứt gót hiệu quả, bệnh nấm móng có nguy hiểm hay không, có loại thuốc nào tốt giúp trị bệnh này không. Collagen là gì? collagen có tác dụng gì đối với cơ thể con người. Nám da có hại gì đối với cơ thể, hiện nay có loại kem trị nám tốt nhất hiện nay không

    ReplyDelete

Post a Comment

Pascal Fares and Open Source Lebanese Movement >

Popular posts from this blog

Go Google Go! A Language on Full Throttle

InfoWorld (12/18/13) Serdar Yegulalp   Go, Google's C-like language, recently was ranked at the top of TechEmpower's eighth round of Web framework benchmarks. Go proved to be the strongest in the JSON serialization test, achieving the best peak performance and the lowest latency scores. The high performance with JSON serialization indicates that Go is being performance-tuned for the same set of workloads most directly associated with frameworks such as Node.js. Node.js' lowest performance was at 14.3 percent of Go's speed, while the best was at 69.1 percent. Node.js has the advantage of a broad software development culture--not just through its package repository, but also because there are many more JavaScript programmers than there are Go programmers. Another newcomer in the benchmarks is Facebook's HipHop PHP VM (HHVM), an open source project that compiles PHP into C++ instead of interpreting it. HHVM was designed to replace Facebook's existing PHP-execution...

How to create RESTful API usig Node for processing HTTP requests.

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine . Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm , is the largest ecosystem of open source libraries. Follow : Create RestFul API node.js and mysql : http://www.9lessons.info/2017/02/create-restful-api-nodejs-mysql.html

New Python Users Group in Lebanon LIPUG

Users of the Python programming language meet periodically in so-called  Python User Groups . Intermediate and advanced users share how they use the language and learn new tricks; they also welcome  beginners  and help them step in. It is a great place to ask for help and socialize with other people with a similar interest. Meetings are usually once every month, they are very informal and open to everyone. The Lebanese Python Users Group is an online group, hosted at github to share, exchange ideas, howtos, snipets, ... in many fields of the Python ecosystem * Functional paradigm * OOP Object paradigm * Reactive programming * Data Science * Machine learning All person and all ideas are welcome. This group will start with the students of the ISSAE Cnam Liban