-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35d0981
Showing
13 changed files
with
3,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node:10 | ||
WORKDIR /usr/app | ||
COPY . . | ||
RUN npm install | ||
EXPOSE 9981 | ||
CMD ["node","app.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
node | ||
{ | ||
|
||
stage("CheckOutCodeGit") | ||
{ | ||
git branch: 'master', credentialsId: '65fb834f-a83b-4fe7-8e11-686245c47a65', url: 'https://github.com/bhaskar0504/node-js-application.git' | ||
} | ||
|
||
stage("Build") | ||
{ | ||
nodejs(nodeJSInstallationName: 'nodejs15.2.1') { | ||
sh 'npm install' | ||
} | ||
} | ||
|
||
stage('ExecuteSonarQubeReport') { | ||
nodejs(nodeJSInstallationName: 'nodejs15.2.1') { | ||
sh 'npm run sonar' | ||
} | ||
|
||
} | ||
|
||
stage('UploadintoNexus') { | ||
nodejs(nodeJSInstallationName: 'nodejs15.2.1') { | ||
sh 'npm publish' | ||
} | ||
|
||
} | ||
|
||
stage('RunNodeJsApp') | ||
{ | ||
//sh "./scripts/run.sh" | ||
nodejs(nodeJSInstallationName: 'nodejs15.2.1') { | ||
sh 'npm start &' | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# nodejs-app-mss | ||
|
||
To start this application first you can get this repo code using below url | ||
|
||
git clone https://github.com/LandmakTechnology/nodejs-application | ||
|
||
cd nodejs-app-mss | ||
|
||
npm install | ||
|
||
**node app.js** | ||
|
||
(OR) | ||
|
||
npm start | ||
|
||
To execute Test cases, we will run the below command | ||
npm test | ||
|
||
To Execute the SonarQube Repor, execute the below command. | ||
|
||
npm run sonar | ||
|
||
(OR) | ||
|
||
node sonar-project.js | ||
|
||
|
||
Generate the Nexus token by using base64 encoding as follows. | ||
|
||
echo -n 'admin:passw0rd' | openssl base64 | ||
|
||
Create a .npmrc file in your project root directory and add below lines. | ||
|
||
registry=<<NexusRepoURL>> | ||
_auth=<<Token>> | ||
email=<<EmailID>> | ||
always-auth=true | ||
|
||
|
||
In package.json add below entry, | ||
|
||
"publishConfig": { | ||
|
||
"registry": "http://IPAddress:8081/repository/nodejs-mithuntechnologies/" | ||
|
||
} | ||
|
||
npm login --registry=NexusRepoURL | ||
|
||
Execute below command to upload packages to nexus repo. | ||
|
||
npm publish | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
var express = require("express"); | ||
const path = require('path'); | ||
const cfenv = require('cfenv'); | ||
|
||
var app = express(); | ||
var appEnv = cfenv.getAppEnv(); | ||
var url = process.env.url | ||
app.set('port', (process.env.PORT || 9981)) | ||
app.use(express.static(__dirname + '/images')) | ||
|
||
|
||
/* | ||
app.get("/getCall", function(req,res){ | ||
console.log("GET Method caled"); | ||
console.log(__dirname); | ||
res.send("<h2>Welcome to Node JS express app</h2>"+appEnv.url+appEnv.port+port+process.env.LOGNAME); | ||
}).listen(9009); | ||
console.log(__dirname+"/images/mylandmarklogo.png"); | ||
*/ | ||
app.get('/landmarktechnologies', function(request, response) { | ||
//response.send("<h2><center>Welcome to Node JS app develpoed by MyLandmarkTech</h2>"); | ||
response.write("<h2><center><u>Node JS Application </u></center></h2>"); | ||
|
||
response.write("<h2><center>Welcome to Landmark Technologies. Please Contact +14372152483 for more information or send an email to [email protected] <center></h2>" ); | ||
response.end(); | ||
|
||
}) | ||
|
||
|
||
//app.get("/html", function(req,res){ | ||
app.get("/html", function(req,res){ | ||
res.set("Content-Type","text/html"); | ||
//res.contentType("html") ; | ||
res.write("<h2>Welcome</h2>"); | ||
res.write("<h2>/html call</h2>"); | ||
//must end | ||
res.end(); | ||
|
||
}); | ||
app.get("/jsonData", function(req,res){ | ||
res.type('json'); | ||
//res.type('application/json'); | ||
//res.json({'name': 'S. Legah'}); | ||
res.send({ | ||
'name': 'Landmark Technologies', | ||
'technology': 'DevOps', | ||
'contact' : '+14372152483', | ||
'email': '[email protected]' | ||
}); | ||
|
||
}); | ||
app.get("/queryparam", function(req,res){ | ||
//res.send(req.query); | ||
res.send(req.query.key + ": " + req.query.name); | ||
}); | ||
|
||
app.get("/status-code-404", function(req, res) { | ||
//set content-type to application/json | ||
//res.sendStatus(404); | ||
res.status(404).send('Sorry, we cannot find that!'); | ||
}) | ||
|
||
app.get("/status-code-500", function(req, res) { | ||
//set content-type to application/json | ||
//res.sendStatus(500); | ||
res.status(500).send('Internal Server Error – custom message'); | ||
}) | ||
|
||
app.get('/redirect', function(req, res) { | ||
//Send status 300 | ||
res.redirect('http://mylandmarktech.com'); | ||
}); | ||
|
||
|
||
app.listen(app.get('port'), function() { | ||
console.log("Node JS app is running at http://localhost:" + app.get('port') +"/landmarktechnologies"); | ||
}) | ||
|
||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.