Sunday, February 12, 2017

Creating a New Expressjs Project


1. C:\Node4Express>npm install express-generator -g

Response :
C:\Users\User\AppData\Roaming\npm\express -> C:\Users\User\AppData\Roaming\npm\n
ode_modules\express-generator\bin\express
C:\Users\User\AppData\Roaming\npm
`-- express-generator@4.14.1

2. After (1), nothing seems to have been created

C:\Node4Express>dir
 Volume in drive C has no label.
 Volume Serial Number is 5449-2F7F

 Directory of C:\Node4Express

12-Feb-17  06:37 PM    <DIR>          .
12-Feb-17  06:37 PM    <DIR>          ..
12-Feb-17  12:16 PM    <DIR>          helloworld
               0 File(s)              0 bytes
               3 Dir(s)  182,920,482,816 bytes free


3. C:\Node4Express>express --view=pug pms4xpress

Response:
   create : pms4express
   create : pms4express/package.json
   create : pms4express/app.js
   create : pms4express/public/stylesheets
   create : pms4express/public/stylesheets/style.css
   create : pms4express/public/javascripts
   create : pms4express/public/images
   create : pms4express/public
   create : pms4express/routes
   create : pms4express/routes/index.js
   create : pms4express/routes/users.js
   create : pms4express/views
   create : pms4express/views/index.pug
   create : pms4express/views/layout.pug
   create : pms4express/views/error.pug
   create : pms4express/bin
   create : pms4express/bin/www

   install dependencies:
     > cd pms4express && npm install

   run the app:
     > SET DEBUG=pms4express:* & npm start
C:\Node4Express>

4. Verifying what has happened

C:\Node4Express>cd pms4express

C:\Node4Express\pms4express>dir
 Volume in drive C has no label.
 Volume Serial Number is 5449-2F7F

 Directory of C:\Node4Express\pms4express
12-Feb-17  06:46 PM    <DIR>          .
12-Feb-17  06:46 PM    <DIR>          ..
12-Feb-17  06:46 PM             1,256 app.js
12-Feb-17  06:46 PM    <DIR>          bin
12-Feb-17  06:46 PM               336 package.json
12-Feb-17  06:46 PM    <DIR>          public
12-Feb-17  06:46 PM    <DIR>          routes
12-Feb-17  06:46 PM    <DIR>          views
               2 File(s)          1,592 bytes
               6 Dir(s)  182,920,138,752 bytes free



5. Installing dependencies :
C:\Node4Express\pms4xpress>npm install

Response:

pms4express@0.0.0 C:\Node4Express\pms4express
+-- body-parser@1.16.1
| +-- bytes@2.4.0
| +-- content-type@1.0.2
| +-- depd@1.1.0
| +-- http-errors@1.5.1
| | +-- inherits@2.0.3
| | +-- setprototypeof@1.0.2
| | `-- statuses@1.3.1
| +-- iconv-lite@0.4.15
| +-- on-finished@2.3.0
| | `-- ee-first@1.1.1
| +-- qs@6.2.1
| +-- raw-body@2.2.0
| | `-- unpipe@1.0.0
| `-- type-is@1.6.14
|   +-- media-typer@0.3.0
|   `-- mime-types@2.1.14
|     `-- mime-db@1.26.0
+-- cookie-parser@1.4.3
| +-- cookie@0.3.1
| `-- cookie-signature@1.0.6
+-- debug@2.6.1
| `-- ms@0.7.2
+-- express@4.14.1
| +-- accepts@1.3.3
| | `-- negotiator@0.6.1
| +-- array-flatten@1.1.1
| +-- content-disposition@0.5.2
| +-- debug@2.2.0
| | `-- ms@0.7.1
| +-- encodeurl@1.0.1
| +-- escape-html@1.0.3
| +-- etag@1.7.0
| +-- finalhandler@0.5.1
| | `-- debug@2.2.0
| |   `-- ms@0.7.1
| +-- fresh@0.3.0
| +-- merge-descriptors@1.0.1
| +-- methods@1.1.2
| +-- parseurl@1.3.1
| +-- path-to-regexp@0.1.7
| +-- proxy-addr@1.1.3
| | +-- forwarded@0.1.0
| | `-- ipaddr.js@1.2.0
| +-- qs@6.2.0
| +-- range-parser@1.2.0
| +-- send@0.14.2
| | +-- debug@2.2.0
| | | `-- ms@0.7.1
| | +-- destroy@1.0.4
| | `-- mime@1.3.4
| +-- serve-static@1.11.2
| +-- utils-merge@1.0.0
| `-- vary@1.1.0
+-- morgan@1.7.0
| +-- basic-auth@1.0.4
| +-- debug@2.2.0
| | `-- ms@0.7.1
| `-- on-headers@1.0.1
+-- pug@2.0.0-beta11
| +-- pug-code-gen@1.1.1
| | +-- constantinople@3.1.0
| | | +-- acorn@3.3.0
| | | `-- is-expression@2.1.0
| | +-- doctypes@1.1.0
| | +-- js-stringify@1.0.2
| | +-- pug-attrs@2.0.2
| | +-- pug-error@1.3.2
| | +-- void-elements@2.0.1
| | `-- with@5.1.1
| |   `-- acorn-globals@3.1.0
| |     `-- acorn@4.0.11
| +-- pug-filters@2.1.1
| | +-- clean-css@3.4.24
| | | +-- commander@2.8.1
| | | | `-- graceful-readlink@1.0.1
| | | `-- source-map@0.4.4
| | |   `-- amdefine@1.0.1
| | +-- jstransformer@1.0.0
| | | +-- is-promise@2.1.0
| | | `-- promise@7.1.1
| | |   `-- asap@2.0.5
| | +-- pug-walk@1.1.1
| | +-- resolve@1.2.0
| | `-- uglify-js@2.7.5
| |   +-- async@0.2.10
| |   +-- source-map@0.5.6
| |   +-- uglify-to-browserify@1.0.2
| |   `-- yargs@3.10.0
| |     +-- camelcase@1.2.1
| |     +-- cliui@2.1.0
| |     | +-- center-align@0.1.3
| |     | | +-- align-text@0.1.4
| |     | | | +-- kind-of@3.1.0
| |     | | | | `-- is-buffer@1.1.4
| |     | | | +-- longest@1.0.1
| |     | | | `-- repeat-string@1.6.1
| |     | | `-- lazy-cache@1.0.4
| |     | +-- right-align@0.1.3
| |     | `-- wordwrap@0.0.2
| |     +-- decamelize@1.2.0
| |     `-- window-size@0.1.0
| +-- pug-lexer@3.0.0
| | +-- character-parser@2.2.0
| | | `-- is-regex@1.0.3
| | `-- is-expression@3.0.0
| |   `-- acorn@4.0.11
| +-- pug-linker@2.0.2
| +-- pug-load@2.0.5
| | `-- object-assign@4.1.1
| +-- pug-parser@2.0.2
| | `-- token-stream@0.0.1
| +-- pug-runtime@2.0.3
| `-- pug-strip-comments@1.0.2
`-- serve-favicon@2.3.2

6. Verifying what has happened

Response : Node_modules folder created

C:\Node4Express\pms4express>dir
 Volume in drive C has no label.
 Volume Serial Number is 5449-2F7F

 Directory of C:\Node4Express\pms4express

12-Feb-17  06:51 PM    <DIR>          .
12-Feb-17  06:51 PM    <DIR>          ..
12-Feb-17  06:46 PM             1,256 app.js
12-Feb-17  06:46 PM    <DIR>          bin
12-Feb-17  06:51 PM    <DIR>          node_modules
12-Feb-17  06:46 PM               336 package.json
12-Feb-17  06:46 PM    <DIR>          public
12-Feb-17  06:46 PM    <DIR>          routes
12-Feb-17  06:46 PM    <DIR>          views
               2 File(s)          1,592 bytes
               7 Dir(s)  182,905,462,784 bytes free

7. What is inside Node_modules ?



8. C:\Node4Express\pms4xpress>set DEBUG=pms4xpress:* & npm start

C:\Node4Express\pms4express\node_modules>set DEBUG=pms4express:* && npm start

> pms4express@0.0.0 start C:\Node4Express\pms4express
> node ./bin/www

  pms4express:server Listening on port 3000 +0ms

9. localhost:3000


No comments:

Post a Comment