Submit Search
Upload
Using Node.js for everything or what it is to write a book about it
•
1 like
•
679 views
Krasimir Tsonev
Follow
A presentation made at RigaDevDay (http://rigadevday.lv/)
Read less
Read more
Software
Report
Share
Report
Share
1 of 40
Download now
Download to read offline
Recommended
Progressive Mobile Web Apps
Progressive Mobile Web Apps
dynamis
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Java script.trend(spec)
Java script.trend(spec)
dynamis
MySQLオンラインマイグレーションツールgh-ostで深夜メンテナンスを無くした話
MySQLオンラインマイグレーションツールgh-ostで深夜メンテナンスを無くした話
Shuto Suzuki
商派信息安全解决方案
商派信息安全解决方案
wanglei999
Hello world
Hello world
Nagarajan S
Task Automatisierung mit Grunt.js
Task Automatisierung mit Grunt.js
3rfan
Config
Config
guest4f11e4
Recommended
Progressive Mobile Web Apps
Progressive Mobile Web Apps
dynamis
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Java script.trend(spec)
Java script.trend(spec)
dynamis
MySQLオンラインマイグレーションツールgh-ostで深夜メンテナンスを無くした話
MySQLオンラインマイグレーションツールgh-ostで深夜メンテナンスを無くした話
Shuto Suzuki
商派信息安全解决方案
商派信息安全解决方案
wanglei999
Hello world
Hello world
Nagarajan S
Task Automatisierung mit Grunt.js
Task Automatisierung mit Grunt.js
3rfan
Config
Config
guest4f11e4
Reactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
Javascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To Tail
Cliffano Subagio
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Nael El Shawwa
Developing large scale JavaScript applications
Developing large scale JavaScript applications
Milan Korsos
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
Unidirectional data flow
Unidirectional data flow
Denis Gorbunov
Modern Web Applications
Modern Web Applications
Ömer Göktuğ Poyraz
More Related Content
Viewers also liked
Reactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
Javascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To Tail
Cliffano Subagio
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Nael El Shawwa
Developing large scale JavaScript applications
Developing large scale JavaScript applications
Milan Korsos
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
Unidirectional data flow
Unidirectional data flow
Denis Gorbunov
Modern Web Applications
Modern Web Applications
Ömer Göktuğ Poyraz
Viewers also liked
(7)
Reactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the ugly
Javascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To Tail
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Developing large scale JavaScript applications
Developing large scale JavaScript applications
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture
Unidirectional data flow
Unidirectional data flow
Modern Web Applications
Modern Web Applications
Using Node.js for everything or what it is to write a book about it
1.
2.
3.
4.
5.
6.
7.
8.
// lib/awesome.js module.exports =
function() { // ... our logic here } // app.js var awesome = require('./lib/awesome');
9.
10.
11.
//package.json { "name":"project-name", "version":"0.1.7", "description":"...", "dependencies":{ "other-module":"1.1.0" } } //terminal npmpublish //terminal npminstallproject-name
12.
13.
14.
var http =
require('http'); var server = http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Worldn'); }); server.listen(5060, '127.0.0.1');
15.
16.
varfs=require('fs'),http=require('http'); varhtml=fs.readFileSync('path/to/my/file.html'); varcss=... varserver=http.createServer(function(req,res){ varextension=... switch(extension){ case"css":contentType="text/css";break; case"html":contentType="text/html";break; case"js":contentType="application/javascript";break; case"ico":contentType="image/ico";break; default:contentType="text/plain"; } res.writeHead(200,{'Content-Type':contentType}); res.end(content+'n'); }); server.listen(5060,'127.0.0.1');
17.
18.
varhttp=require('http'); http.createServer(function(req,res){ if(req.url==='/api'){ res.writeHead(200,{'Content-Type':'application/json'}); switch(req.method){ case'GET':res.end('{"get":"OK"}');break; case'POST':res.end('{"post":"OK"}');break; case'PUT':res.end('{"put":"OK"}');break; case'DELETE':res.end('{"delete":"OK"}');break; } }else{ res.writeHead(200,{'Content-Type':'text/plain'}); res.end('<html><body>...n'); } }).listen(5060,'127.0.0.1'); console.log('Serverrunningathttp://127.0.0.1:5060/');
19.
20.
21.
22.
// gulpfile.js var gulp
= require('gulp'); var concat = require('gulp-concat'); gulp.task('scripts', function() { gulp.src('./lib/*.js') .pipe(concat('all.js')) .pipe(gulp.dest('./dist/')) }); // terminal gulp scripts
23.
//Gruntfile.js module.exports=function(grunt){ grunt.initConfig({ concat:{ javascript:{ options:{}, src:['./lib/*.js'], dest:'build/scripts.js' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.registerTask('default',['concat']); } //terminal grunt
24.
25.
26.
27.
28.
29.
30.
describe("TestingTODOMVC",function(){ before(function(){ app.todos.reset(); }); it("AddingnewTODOs",function(){ //...dosomething expect($('#todo-listli').length).to.be.equal(2); }); });
31.
32.
33.
34.
35.
36.
//server vario=require('socket.io')(http); io.on('connection',function(socket){ socket.on('message-type',function(msg){ socket.emit('message-received','OK'); }); }); //browser //<scriptsrc="/socket.io/socket.io.js"></script> varsocket=io(); socket.emit('message-type','Helloworld!');
Download now