GithubHelp home page GithubHelp logo

manuelkiessling / nodebeginner.org Goto Github PK

View Code? Open in Web Editor NEW
4.0K 321.0 1.5K 5.87 MB

A comprehensive Node.js tutorial for beginners

Home Page: https://www.nodebeginner.org

License: Other

HTML 96.57% JavaScript 0.47% CSS 2.73% PHP 0.17% Hack 0.06%

nodebeginner.org's Introduction

nodebeginner.org's People

Contributors

aaronontheweb avatar ashokgelal avatar bcuz avatar blackymetal avatar briandurham avatar ceclinux avatar chnbin avatar dai1741 avatar doggy8088 avatar doortts avatar epmatsw avatar eu81273 avatar gruner avatar gurjeet avatar jackzzjack avatar joshuajabbour avatar juanitofatas avatar julien-c avatar manuelkiessling avatar merlinran avatar ndfa avatar sachu avatar samsm avatar sangm avatar spmbt avatar stoneshim avatar termosa avatar tuanva avatar yaotti avatar z3t1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodebeginner.org's Issues

Explain the 'export' object

In the section where server.js is turned into a node module, the following is introduced:

exports.start = start;

It would be nice if the exports object was introduced. It's not entirely clear what it does, other than "it just works."

Could you pls NOT translate object names into Chinese?

You know, in the programming world, nouns used to act as multiple roles. Especially those has general meanings, such as server, router, etc.

For example, server could indicate a physical server, a logical server, and an object which name happens to be the word 'server'. If you translate them all into Chinese, people may have trouble to distinguish them and to understand what you really mean to.

Here is an example at url http://www.nodebeginner.org/index-zh-cn.html#routing-to-real-request-handlers

I believe the word 服务器 and 路由 here would mean to be objects instead of a real physical HTTP server and a physical router. Because in the context I believe you would really mean to transfer the request to the code snippet in the server.js and then to the code snippet in the router.js.

If you just keep them as is in English, it would be much clearer to the readers.

这意味着我们得将请求处理程序从服务器传递到路由中,但
感觉上这么做更离谱了,我们得一路把这堆请求处理程序从
我们的主文件传递到服务器中,再将之从服务器传递到路由。

undefined is not a function at route(pathname)

From router beginning example:

index.js

var server = require("./server");
var router = require("./router");

server.start()

server.js

var http = require("http");
var url  = require("url");

function start(route) {
    function onRequest(request, response) {
        var pathname = url.parse(request.url).pathname;
        console.log("Request for " + pathname + " recieved.");

        route(pathname);

        response.writeHead(200, {
            "Content-Type": "text/plain"
        });
        response.write("Hello, world!");
        response.end();
    }

    http.createServer(onRequest).listen(8888);
    console.log("Server has started.");
}

exports.start = start;

router.js

function route(pathname) {
    console.log("Abount to route a request for " + pathname);
}

exports.route = route;

Error output:

c:\Projects\Personal\Node\learning-gulp\server.js:10
        route(pathname);
        ^
TypeError: undefined is not a function
    at Server.onRequest (c:\Projects\Personal\Node\learning-gulp\server.js:10:9)
    at Server.emit (events.js:110:17)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:491:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
    at Socket.socketOnData (_http_server.js:343:22)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)

DepreciationWarning: Calling an asynchronous function without callback is deprecated

I keep getting this error with my own code as well as your version of the application which I downloaded from this repo. Also, when I upload the image it doesn't appear in the tmp/ directory, Any ideas on how to fix?

(node:14700) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:14700) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
fs.js:90
      throw err;  // Forgot a callback but don't know where? Use NODE_DEBUG=fs
      ^

Error: ENOENT: no such file or directory, unlink 'D:\Documents\GitHub\projects\node.js-beginner-web-app\tmp\test.png'

http://localhost:8888/upload returns this:

error

I'm using node 7.4.0 and the latest version of formidable.

Change subir instead upload

Hi guys i find a minor detail in
var exec = require("child_process").exec;

function iniciar(response) {
console.log("Manipulador de petición 'iniciar' fue llamado.");

exec("ls -lah", function (error, stdout, stderr) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write(stdout);
response.end();
});
}
//The name of the function its wrong and throw an exception change subir instead
function upload(response) {
console.log("Manipulador de petición 'subir' fue llamado.");
response.writeHead(200, {"Content-Type": "text/html"});
response.write("Hola Subir");
response.end();
}

exports.iniciar = iniciar;
exports.subir = subir;

Still doesn't work on windows for 'show image right after uploading'

The latest zipped code doesn't work on windows for file renaming. So I resort to file copying instead.

Dig in for a while. Come up with one solution. See below.

In the upload request handler, use code below for file copying.

fs.createReadStream(files.upload.path).
pipe(fs.createWriteStream('/tmp/test.jpg').
on('close', function(){
response.writeHead(200, {"Content-Type": "text/html"});
response.write("received image:
");
response.write("");
response.end();
}));

Unable to compile requestHandlers.js

Receive below error when compling with NodeJs version 0.10.35 (downloaded from http://nodejs.org/download/)

C:\A Work\Study\NodeJs\Code>node index.js

module.js:340
throw err;
^
Error: Cannot find module 'formidable'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\A Work\Study\NodeJs\Code\requestHandlers.js:3:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

C:\A Work\Study\NodeJs\Code>

var url = require('url');

这句代码没有生效,是自己写的url模块,还是nodejs自带的?无法获取pathname

tmp folder should be in which path

fs.js:101
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
^

Error: ENOENT: no such file or directory, unlink 'D:\tmp\test.png'
at Error (native)

why cause this ?

Quotation marks in PDF

Hi - please forgive me if this isn't the best place to post this issue. I just happily paid for the eBook version of The Node Beginner Book - the beginning was excellent and I'm continuing to enjoy the book. I've switched to the PDF version, and I'm a bit dismayed to find that all of the quotation mark pairs are ”mangled”. (It's not incredibly obvious in this font, but all of the quotation marks are right double quotes, which looks painful in a serif font.

It looks like there are at least some apostrophe issues, too. (See page 31, where "we're" becomes "weâ€TMre".

These aren't huge issues and I don't regret buying the book, but it'd be lovely not to have these ugly typographic stains on an otherwise great product.

iPad view

Hi there, thanks for the fantastic resource!

It'd be fantastic to read this book on tablets. I tried very briefly to fix the site view on my iPad, but I can't come up with an 'elegant' solution. Basically, because #book is 640px wide and the font is large, the book content is crammed within a thin vertical strip, making it hard to read.

I messed with #book width, setting it to 1000px, which improves things but it's a terrible hack. You could potentially use Javascript to test whether it's being displayed on an iPad, and set the width accordingly (still a hack).

Or perhaps use a JS lib that detects a mobile device and uses a completely different layout, more suited for tablets/mobile?

Anyway, thanks again!

Is this repos active?

It seems its been a while you've not been here @manuelkiessling . Isn't it?
There are some easy-to-solve issues, some solved ones(like #65 ), even two test(!) issues and no one is responsible for them.

Will you continue to develop the project or we should fork it(I myself prefer to continue on the main branch/version)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.