Supporting files n documents can be downloaded from:
Disable port 80 from inetmgs à bindings (change it to some other port eg 8082 while
deploying a node app)
Update startup.bat,
Script.ps1 and Start.ps1 files
From the task scheduler, map
the strartup script
Steps to install PM2:
PS
C:\Windows\system32> npm install pm2 –g
Steps to install Node:
Download node .msi
from https://nodejs.org/en/download/
Steps to install Mongo:
- Open power shell in admin mode
- Download chocolatey
PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force;
iex ((New-Object
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- Install Mongo DB (at C drive root)
PS C:\> choco install mongodb
Select Y on both the install questions, detailed
below:
Do you want to run the script?([Y]es/[N]o/[P]rint):
Timeout or your choice of '' is not a valid
selection.
You must select an answer
Do you want to run the script?([Y]es/[N]o/[P]rint): Y
mongodb package files install completed. Performing
other installation steps.
The package mongodb wants to run
'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation
will fail.
Note: To confirm automatically next time, use '-y' or
consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): Y
- Check the newly created directories (cd '.\Program Files\MongoDB\Server\3.4\bin)
PS C:\> cd '.\Program Files'
PS C:\Program Files> dir
1.
PS C:\Program Files> cd .\MongoDB
a.
PS C:\Program Files\MongoDB> dir
2.
PS C:\Program Files\MongoDB> cd .\Server
a.
PS C:\Program Files\MongoDB\Server> dir
3.
PS C:\Program Files\MongoDB\Server> cd .\3.4
a.
PS C:\Program Files\MongoDB\Server\3.4> dir
4.
PS C:\Program Files\MongoDB\Server\3.4> cd
.\bin
a.
PS C:\Program Files\MongoDB\Server\3.4\bin>
dir
- Navigate to C directory and make folder for mongoDB and nested DB folder for project DB (tlv in this case)
PS C:\Program Files\MongoDB\Server\3.4\bin> cd /
PS C:\> mkdir mongodb-data
PS C:\> cd .\mongodb-data
PS C:\mongodb-data> dir
PS C:\mongodb-data> mkdir tlv
- Create a mongo DB in the tlv directory (created above) using the below command (default the server would start at port=27017)
PS C:\> & '.\Program
Files\MongoDB\Server\3.4\bin\mongod.exe' --dbpath C:\mongodb-data\tlv
Alternatively we can also specify port no while
creating the mongo DB, details below (now mongo DB is listening at port =
34355, localhost:34355 )
PS C:\> & '.\Program
Files\MongoDB\Server\3.4\bin\mongod.exe' --dbpath C:\mongodb-data\tlv --port
34355
Invoking Mongo
as a service: "C:\Program
Files\MongoDB\Server\3.6\bin\mongod.exe" --config "C:\Program
Files\MongoDB\Server\3.6\mongod.cfg" –install
Mongo DB dump and restore
- Dump command: PS C:\Program Files\MongoDB\Server\3.4\bin> .\mongodump
It would create the dump in C:\Program
Files\MongoDB\Server\3.4\bin\dump
- Restore DB: PS C:\Program Files\MongoDB\Server\3.4\bin> ./mongorestore /h localhost /db tlvdashboard 'C:\Users\Pahuja Saurabh\Desktop\tlvdashboard'
StartNodeService.xml (file to
import in task scheduler)
Open
taskScheduler à on the top left "in the
task scheduler library (task scheduler à task scheduler library)" à
in the top right pane, select import taskà chose the attached
StartNodeService.xml file
Mongo with TypeScript
- https://gist.github.com/brennanMKE/ee8ea002d305d4539ef6
- https://stackoverflow.com/questions/34482136/mongoose-the-typescript-way
- https://gallery.technet.microsoft.com/Application-Example-NodeJS-d632ee2d
- http://acdcjunior.github.io/typescript-cast-object-to-other-type-or-instanceof.html
- http://2ality.com/2017/08/promise-callback-data-flow.html
- https://code.tutsplus.com/articles/an-introduction-to-mongoose-for-mongodb-and-nodejs--cms-29527 - article on mongoDB n Mongoose
Very good content.Thanks for sharing.
ReplyDeleteFull Stack Online Training