× Main Home STAGE-1
☰ Nodejs

NODE JS

Node.js is an open-source, cross-platform, back-end, JavaScript runtime environment that executes JavaScript code outside a web browser.
Original author: Ryan Dahl
License: MIT license
Initial release: May 27, 2009; 11 years ago
Operating system: z/OS, Linux, macOS, Microsoft Windows, SmartOS, FreeBSD, OpenBSD, IBM AIX
Written in: C, C++, JavaScript

Stage Study - 1
Installation Start
npx express-generator --hbs
npm install
npm install nodemon -g
npm install express-handlebars

npm install express-fileupload
node bin/www
Views Views/layout
layout
partial
index.hbs
error.hbs
layout.hbs
Views/partials index.hbs
admin-header.hbs
user-header.hbs
section part
index.js layout.hbs
res.render('index', {admin:true}); {{#if admin}}
{{>admin-header}}
{{else}}
{{>user-header}}
{{/if}}
{{{body}}}
admin-header.hbs user-header.hbs
section part Navbar for Admin
app.js
app.engine(
'hbs',hbs({
extname:'hbs',
defaultLayout:'layout',
layoutsDir:__dirname +'/views/layout/',
partialsDir:__dirname +'/views/partials/'
}));
Stage Study - 2
Views routes
admin
user
layout
partials
admin.js
user.js
views/admin views/user
add-product.hbs
view-products.hbs
error.hbs
index.hbs
Views/partials views/layout
admin-header.hbs
user-header.hbs
section part
add-product.hbs view-products.hbs
{{#each products}} ....... {{/each}}
admin-header.hbs user-header.hbs
admin-header section user header section
app.js
var hbs=require('express-handlebars')
var fileUpload=require('express-fileupload')
app.use(fileUpload())
Npm2Deb
$ sudo apt-get install npm2deb
  • Project start
  • mkdir packaging
  • cd packaging/
  • wget link here (not needed for npm2deb)
  • npm2deb create pretty-ms
  • use lintian and correct errors
......................................................
For more info click here
......................................................