Node.js examples from Düüna's book ⬆
Directory samples_Duuna\
contains Node.js examples presented in Düüna's book "Secure Your Node.js Web Application" (The Pragmatic Programmers, 2016). |
Executing command npm start
in directory samples_Duuna\chp-3-networking\
performs two tasks:
- it starts the server application which listen to client requests on port
3000
(defined in fileconfig.json
1). - it opens the
http:/127.0.0.1:3000
URL in your default web browser.
First we start the server application in a new console:
> start npm start > [email protected] start N:\samples_Duuna\chp-3-networking > node ./npm_scripts/start_browser.js && node . Node runtime: v16.20.2 (x64) Module search path: (none) Server listening on port 3000
Then we start the client application in the current console:
> npm run client > [email protected] client N:\samples_Duuna\chp-3-networking > node ./npm_scripts/start_client.js en hello world de hello world fr hello world
chp-4-code-injection
Example ▴
Executing command npm start
in directory samples_Duuna\chp-4-code-injection\
performs two tasks:
- it starts the server application which listen to client requests on port
3000
(defined in fileconfig.json
1). - it opens the
http:/127.0.0.1:3000
URL in your default web browser.
> npm start > [email protected] start N:\samples_Duuna\chp-4-code-injection > node ./npm_scripts/start_browser.js && node . Node runtime: v18.20.4 (x64) Module search path: (none) Server listening on port 3000
Footnotes ▴
[1] config.json
↩
-
Only the template file
config_TEMPLATE.json
is stored in our GitHub repository. The user has to copy it toconfig.json
and update the two JSON fieldshost
andport
as desired before running the above code examples.