Related Post

22 Replies to “Node JS Tutorial for Beginners #12 – Creating a Server”

  1. Hi, I did console.log(req);

    And a whole bunch of crap got printed like this:

    IncomingMessage {
    _readableState:
    ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: null,
    pipesCount: 0,
    flowing: null,
    ended: false,
    endEmitted: false,
    reading: false,
    sync: true,
    needReadable: false,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    destroyed: false,
    defaultEncoding: 'utf8',
    awaitDrain: 0,
    readingMore: true,
    decoder: null,
    encoding: null },
    readable: true,
    domain: null,
    _events: {},
    _eventsCount: 0,
    _maxListeners: undefined,
    socket:
    Socket {
    connecting: false,
    _hadError: false,
    _handle:
    TCP {
    reading: true,
    owner: [Circular],
    onread: [Function: onread],
    onconnection: null,
    writeQueueSize: 0,
    _consumed: true },
    _parent: null,
    _host: null,
    _readableState:
    ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: [Object],
    length: 0,
    pipes: null,
    pipesCount: 0,
    flowing: true,
    ended: false,
    endEmitted: false,
    reading: true,
    sync: false,
    needReadable: true,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    destroyed: false,
    defaultEncoding: 'utf8',
    awaitDrain: 0,
    readingMore: false,
    decoder: null,
    encoding: null },
    readable: true,
    domain: null,

    Could you do a video explaining the common headers of a request?

  2. I can access it using 127.0.0.1:3000. How do I make it available on the internet? I have amazon server. I added my IP address as well (as below) but it doesnt work. Also tried using different port like 8080. Am I missing anything?

    server.listen(3000, '<IP_Address>');

  3. I know you did this a while ago, but when I try this at 127.0.0.1:3000, it doesn't load the page with the text, it downloads a file with no extension containing the text in res.end('Hey ninjas'). Do you know why and how to fix this?

    Thanks

  4. How can one make the page to refresh automatically everytime one saves the editor, like we use to see in ReactJS, Angular, etc?

    Anyways, thanks for the lesson!

  5. I can get it to work using server.listen(); but not when I add a port. I am using it on a hosted server so maybe that is why…

  6. .. weird question, my request was made by favicon.ico, is this ok? seems like potentially my data even locally is all being run through this instead directly

  7. #HELP, OS(Ubuntu 18.04), I have a problem here(6:40) when I put IPAddress + Port Number (that I mentioned in code ) in my Browser, it pops out a modal instead opening that text in my browser. And modal ask me to download that TEXT ( Hey Ninjas ) which is mentioned in my code.

Leave a Reply

Your email address will not be published. Required fields are marked *