Node.js examples ⬆
The samples\ directory contains Node.js examples coming from various websites - mostly from the Node.js project. |
Command npm start
executes application app\app.js
which prints the following output (package.json
):
> npm start > auth-passport@0.0.1 start N:\samples\auth-passport > node app/app.js Module search path: (none) Express server listening on port 8180 [ { _id: 56f866add85f33503232ad41, firstName: 'John', lastName: 'Smith', username: 'john', password: '$2a$10$1t4NF.43jzLs51DfZYh9E.CahXkLHIsLChYUcDRwGRYCRumCjcwNC', email: 'john.smith@gmail.com', gender: 'Male', address: 'NY city', __v: 0 } ]
Command npm start
executes application app\app.js
which performs two tasks (package.json
):
- it starts the server application which listen to your requests on port
8180
(defined in fileconfig.json
). - it opens the
http:/127.0.0.1:8180
URL in your default web browser:
> npm start > locales-1-app@0.0.1 start N:\samples\locales-1 > node ./npm_scripts/start_browser.js && node . Node runtime: 18.20.4 (x64) Module search path: (none) Server listening on port 8180
The following text is displayed in your default web browser:
Salut
locales-2
Example ▴
Command npm start
executes application app\app.js
which performs two tasks (package.json
):
- it starts the server application which listen to your requests on port
8180
(defined in fileconfig.json
). - it opens the
http:/127.0.0.1:8180
URL in your default web browser:
> npm start > locales-2-app@0.0.1 start N:\samples\locales-2 > node ./npm_scripts/start_browser.js && node . Node runtime: 18.20.4 (x64) Module search path: (none) Server listening on port 8180 fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3 en fr de
Command npm run client
displays the following output in a separate Windows console:
> npm run client > locales-2-app@0.0.1 client N:\samples\locales-2 > node ./npm_scripts/start_client.js en <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Hello World</title> </head> <body> <h1>Hello</h1> </body> </html> fr <!DOCTYPE html> <html lang="fr" dir="ltr"> <head> <meta charset="utf-8"> <title>Salut le monde</title> </head> <body> <h1>Salut</h1> </body> </html> de <!DOCTYPE html> <html lang="de" dir="ltr"> <head> <meta charset="utf-8"> <title>Hallo Welt</title> </head> <body> <h1>Hallo</h1> </body> </html>
Command npm start
executes application app\app.js
which plays the audio file Paradise.m4a
in your default web browser:
> npm start > music-engine@1.0.0 start N:\samples\webaudio-sample > node ./npm_scripts/start_browser.js && node . Module search path: (none) Express server listening on port 8180 Returning Paradise.m4a for request /music