Welcome to the Linux Foundation Forum!

LFW212 | Server Crashes and Deprecated URL

Options

Chapter 03. CREATING A WEB SERVER | Creating a Web Server with Node Core (3), the server crashes when node -e "http.request('http://localhost:3000', { method: 'POST' }, res => res.pipe(process.stdout)).end()" is run on the terminal.

There should be a return statement in the if block where we check if the method is 'GET' or not.


Also url seems to be depracated.

Answers

  • krave
    krave Posts: 58
    Options

    Yes, url is deprecated. But the usage of whatwg URL in this scenario is not as compact as of url.

Categories

Upcoming Training