Node.js
| Node.js | |
|---|---|
| Pembuat asal | Ryan Lienhart Dahl |
| Pembangun | Para pembangun Node.js, Joyent |
| Pelancaran pertama | 27 Mei 2009 |
| Versi terkini/stabil | 17.7.0 (09 Mac 2022) |
| Ditulis dalam | C, C++, JavaScript |
| Sistem pengendalian | Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (versi lama memerlukan Cygwin), webOS |
| Jenis | Application framework (en) |
| Genre | Rangkaian berpacu peristiwa |
| Lesen | Lesen MIT |
| Pautan berkaitan | |
| Tapak web | nodejs |
| Blog | |
| Repositori | https://github.com/nodejs/node |
| Pautan lain | |
| sunting · sunting di Wikidata | |
Node.js ialah sistem perisian sebelah pelayan yang direka untuk menulis aplikasi Internet boleh skala, umumnya pelayan web.[1] Atur-atur cara ditulis dalam JavaScript di bahagian pelayan, menggunakan I/O taksegerak berpacu peristiwa untuk meminimumkan overhed dan memaksimakan kebolehskalaan.[2]
Node.js adalah himpunan pakej bagi enjin JavaScript V8 Google, lapisan pengabstrakan pelantar libUV, dan sebuah pustaka teras yang ditulis terutamanya dalam JavaScript.
Node.js dicipta oleh Ryan Dahl bermula dari tahun 2009, dan perkembangannya ditaja oleh majikannya, Joyent.[3][4]
Contoh
Berikut ialah pelaksanaan lengkap hello world sebagai pelayan HTTP dalam Node.js:
var http = require('http');
http.createServer(
function (request, response)
{
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}
).listen(8000);
console.log('Pelayan dijalankan di http://localhost:8000/');
Kod berikut ialah pelayan TCP ringkas yang mendengar pada port 7000 kemudian echo 'hai' semasa bersambung:
var net = require('net');
net.createServer(
function (stream)
{
stream.write('hai\r\n');
stream.on( 'end',
function ()
{
stream.end('selamat tinggal\r\n');
}
);
stream.pipe(stream);
}
).listen(7000);
Lihat juga
- npm – pengurus pakej utama untuk Node.js. Semenjak Node.js versi 0.6.3, npm dipasang siap bersama Node.js
Rujukan
- ^ Wait, What's Node.js Good for Again? Diarkibkan 2012-10-14 di Wayback Machine, oleh Klint Finley, 25 Januari 2011, ReadWriteHack
- ^ Cade Metz (1 Mac 2011). "The Node Ahead: JavaScript leaps from browser into future". The Register. Italic or bold markup not allowed in:
|publisher=(bantuan) - ^ Why Everyone Is Talking About Node, oleh Jolie O'Dell, 10 Mac 2011, Mashable
- ^ Alex Handy (2011-06-24). "Node.js pushes JavaScript to the server-side". SDTimes. Dicapai pada 2012-12-20.
Pautan luar
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
