前端人学后端语言是NodeJS好还是PHP好?

JavaScript025

前端人学后端语言是NodeJS好还是PHP好?,第1张

有兴趣或者有精力的话两个都学 都了解一下。学Node.js对前端比较有帮助,大有裨益,而深入学习的话将引出一系列技术栈包括但不限于jade,ejs,less,express,mongodb, Mongoose ,npm,gulp,模块化,中间件,WebSocket,Socket.io,RESTful架构,测试Mocha + should.js以及bootstrap等.

centos 6.4 64bit

安装了

Python 2.6.6

node v0.10.7

MongoDB shell version: 2.4.3

直接下载

https://github.com/cnodejs/nodeclub/archive/master.zip

解压后 运行

npm install -d

然后测试

make test

输出内容

npm WARN package.json nodeclub[@0](/user/0).3.3 No repository field.

npm WARN package.json debug[@0](/user/0).7.0 No repository field.

npm WARN package.json growl[@1](/user/1).7.0 No repository field.

npm WARN package.json ms[@0](/user/0).3.0 No repository field.

npm WARN package.json addressparser[@0](/user/0).1.3 No repository field.

path.exists is now called `fs.exists`.

controllers/site.js

✓ should /index 200 (142ms)

✓ should /?q=neverexistskeyword 200 (108ms)

✓ should /?q=neverexistskeyword&q=foo2 200 (48ms)

--------------------省略----------------------------------

✖ 4 of 83 tests failed:

1) showdown xss test should escape illegal url in a:

actual expected

<p><a href="http://localhostbbs.cnodejsyouku.orgcom:3000javascript:alert(123)">illegal url</a></p>

at Object.Assertion.equal (/home/admin/domains/youku.com/public_html/bbs/node_modules/should/lib/should.js:303:10)

at Context.<anonymous>(/home/admin/domains/youku.com/public_html/bbs/test/public/libs_showdown.js:18:19)

at Test.Runnable.run (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runnable.js:213:32)

at Runner.runTest (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:351:10)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:397:12

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:277:14)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:286:7

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:234:23)

at Object._onImmediate (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:254:5)

at processImmediate [as _immediateCallback] (timers.js:330:15)

2) showdown xss test should escape " in a:

actual expected

<p><a href="http://localhostbbs.cnodejsyouku.orgcom:3000http://baidu.com"onmouseover='alert(123)'">illegal url</a></p>

at Object.Assertion.equal (/home/admin/domains/youku.com/public_html/bbs/node_modules/should/lib/should.js:303:10)

at Context.<anonymous>(/home/admin/domains/youku.com/public_html/bbs/test/public/libs_showdown.js:24:19)

at Test.Runnable.run (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runnable.js:213:32)

at Runner.runTest (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:351:10)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:397:12

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:277:14)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:286:7

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:234:23)

at Object._onImmediate (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:254:5)

at processImmediate [as _immediateCallback] (timers.js:330:15)

3) showdown xss test should escape illegal url in img:

actual expected

<p><img src="http://localhostbbs.cnodejsyouku.orgcom:3000javascript:alert(123)" alt="illegal url" title="" /></p>

at Object.Assertion.equal (/home/admin/domains/youku.com/public_html/bbs/node_modules/should/lib/should.js:303:10)

at Context.<anonymous>(/home/admin/domains/youku.com/public_html/bbs/test/public/libs_showdown.js:30:19)

at Test.Runnable.run (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runnable.js:213:32)

at Runner.runTest (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:351:10)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:397:12

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:277:14)

at /home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:286:7

at next (/home/admin/domains/youku.com/public_html/bbs/node_modules/mocha/lib/runner.js:234:23)