Closed AliMD closed 11 years ago
@AliMD pish niazesh chi hast ostad? albate Node.js tuie ali.md/regclass S3 hast gamunam inja eshteba neveshtin S1 ....?
heif js balad nistam :| vagarna ashegh iin node.js shodam !
@ehsansh S1 yani jalase aval :D @mghayour jan ! toro che be node.js akhe ! aval js ro herfeyi shod bad
Hello ! I'm Frist
thanks sire ... :D
man az haminja elam mikonam ke eftekhar mikonam az inke kenare jenabe aghaye @AliGH neshastam
man Ham Az inke dar kenar Ostad Azim jenab @MOHS3N hastam , Hangam
hey ... Thanks ... :)
hhi there
o.
ye file index.html besazid ! va code zir ro be Non-blocking taghir bedid
var fs = require('fs');
var contents = fs.readFileSync('index.html');
console.log(contents);
var http = require('http');
http.createServer(function(request, response) {
// Answer goes here.
}).listen(8080);
ye file index.html besazid ! va code zir ro be Non-blocking taghir bedid
var fs = require('fs');
var contents = fs.readFileSync('index.html');
console.log(contents);
var fs = require('fs'); back = function( err , contents ){ console.log(contents+''); } fs.readFile('index.html',back(err , contents));
var fs = require('fs');
var callback2 = function(error, contents) {
console.log(contents);
};
fs.readFile('index.html', callback2);
console.log('ZendehAm');
class work 2
var fs = require('fs');
fs.readFile('index.html',function(err,content){
console.log(content+"");
});
console.log("man va to");
mesale balaro bejaye inke too console log kone, ye server besazin va be client befrestin ye chizi too in maye ha
var
http = require('http'),
fs = require('fs');
http.createServer(function(request, response) {
response.writeHead(200);
response.end();
}).listen(8080);
var
http = require('http'),
fs = require('fs');
http.createServer(function(request, response) {
response.writeHead(200);
var html = fs.readFileSync('index.html');
response.write(html);
response.end();
}).listen(3030);
Ok is :end:
var
http = require('http'),
fs = require('fs');
http.createServer(function(request, response) {
response.writeHead(200);
fs.readFile('index.html',function(err,contents){
response.write(contents);
response.end();
});
}).listen(1251);
class work 3
var http = require('http');
var fs = require('fs');
http.createServer(function(req, res) {
res.writeHead(200);
fs.readFile('index.html',function(err,content){
res.write('man va to va ooo' + content);
res.end();
});
}).listen(4321);
writeHead
mitoone parameter haye bishtari begire
http://nodejs.org/docs/v0.6.18/api/http.html#http_response_writehead_statuscode_reasonphrase_headers
mikham yek Content-Type
barabare text/html
ham be browser befrestid
classwork hayi ke moondesh ro be onvane homework anjam bedid
@AliMD ostad man mitunam in dore ro biam? man bekham js bishtar iad begiram baiad biam hamin kelas ia S2?
Az daste in Node.js Emshab be bi khabi mofrad dochaar shodam Va Be sorat kamelan tasadofi Az in Babat Khoshalam :trollface:
@ehsansh nemidoonam cheghadr be js alaghe mand shodi vali alan bayad hadde aghal ye proje tejari besazi bad khodet raheto entekhab koni w4 va w5 baraye bahs haye mali barat lazem tare vali in class (s2) baraye yadgiriye shakhsi khoobe felan barat karborde maliye khassi nadare tasmim ba khodet
khob ba arze poshesh babate dir hazer shodan! :dancer: hazeeeeeeeeeeeeeeeer! :D
@AliMD man mikham ye site static ro ba node.js bala beyaram. OK?
response.writeHead(200,{
'Content-Type': 'text/html',
});
vali natonestam img ha css ha ro load konam. toye console in error neshon midee
Resource interpreted as Image but transferred with MIME type text/html
image ro nbayad khob type text bedi dg! image typesh text nis bara hamn in error ro mide!
@Mrshcom Dorost megi mohammadReza , vali man nemitonam chanta Content-Type
Benvisam , age chanta benevisam Hamishe Akharin 'Content-Type
estefadeh mikone
@AliMD mamnun az rahnamaie. pas man hamun W4 ia W5 ro miam k lazemtare ta bad..... dostan bebakhshid vasate kelas umadam Good Luck :)
in term faghat 3 class mitoonam tashkil bedam
@nasser-torabzade, @mrmr68, @jafarrasooli, @artajalli mohsen migoft azinke poshte sare jquery bad goftam kami delkhor shodin ! chon team khoobi hastin ino migam, yek developer hich vaght az taghir, pishraft va test rah haye jadid nemitarse. az tarafi in class hich rabti be jquery ya layout man dar css nadare !!! be har hal agar roozi nazaratam ro ghabool kardid man hamchenan dar khedmatam.
@AliMD plz help me . manoo Nejad Bedeh az dast enna . Man nemikham Az Aghaedam Dast Bekesham.
Welcome
Salam, In class janbeye ashnayi ba class node.js ro dare mamoolan hame sare asp va php dava daran vali ma mihkaym begim bikhiyal har2 say mikonam bishtar farsi benevisam ta mafahim roshan beshe
Intro
Node.js be shoma ejaze mide ta network application haro ba javascript samte server besazid ! Yani: Server Side JavaScript ! Node.js az V8 JavaScript Runtime estefade mikone, Yani: Chrome JavaScript Engine ! (Fastest js engine)
Usage
Be che darde ma mikhore ?!
Its Not
nabayad dar morede node.js eshtebah konid
None Blocking Programming
Blocking Code
Non-Blocking Code
or
Blocking vs Non-Blocking
Read file 1 : 10s Read file 2 : 12s
Blocking : Read 2 file take 22s Non-Blocking : Read 2 file take 12s or little more
Hello Class
hello.js
The event loop
Dar har zaman faghat yek event pardazesh mishe !
Another Sample
Blocking vs Non-Blocking
Class Works
Register
Baraye doostani ke tamayol be sherkat dar class ro darand, hanooz ham forsate sabte nam hast, http://ali.md/regclass