Skip to content

Commit 773756c

Browse files
author
Ubuntu
committed
Add Node.js app and SonarQube config files
1 parent 37df543 commit 773756c

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

app.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const express = require('express');
2+
const app = express();
3+
const port = 3000;
4+
5+
app.get('/', (req, res) => {
6+
res.send('🚀 Hello from your CI/CD pipeline-deployed Node.js app!');
7+
});
8+
9+
app.listen(port, () => {
10+
console.log(`App running at http://localhost:${port}`);
11+
});
12+
13+

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "ci-cd-sample-app",
3+
"version": "1.0.0",
4+
"description": "Node.js CI/CD test app for EC2 deployment",
5+
"main": "app.js",
6+
"scripts": {
7+
"start": "node app.js"
8+
},
9+
"author": "Your Name",
10+
"license": "ISC",
11+
"dependencies": {
12+
"express": "^4.18.2"
13+
}
14+
}

sonar-project.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sonar.projectKey=ci-cd-sample-app
2+
sonar.projectName=CI/CD Sample App
3+
sonar.projectVersion=1.0
4+
sonar.sources=.
5+
sonar.language=js
6+
sonar.sourceEncoding=UTF-8

start.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
cd ~/devsecops
3+
npm install
4+
pkill node || true
5+
nohup node app.js > output.log 2>&1 &

0 commit comments

Comments
 (0)