-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
1 parent
e61dc3f
commit f286ca3
Showing
5 changed files
with
48 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,7 @@ | ||
FROM registry.access.redhat.com/ubi8/nodejs-12 | ||
|
||
# Copy app | ||
COPY . . | ||
|
||
EXPOSE 3000 | ||
ENTRYPOINT [ "node", "server" ] |
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,17 @@ | ||
pipeline { | ||
agent { label 'nodejs' } | ||
|
||
// Set your OCP project | ||
environment { APP_NAMESPACE = '...' } | ||
|
||
stages{ | ||
|
||
stage('Test'){ | ||
steps { | ||
sh "node test.js" | ||
} | ||
} | ||
|
||
// Add more stages here | ||
} | ||
} |
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,3 @@ | ||
module.exports = function greet(name) { | ||
return `Hello ${name || "student"}`; | ||
} |
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,16 @@ | ||
const http = require("http"); | ||
const url = require("url"); | ||
const greet = require("./greet"); | ||
|
||
const server = http.createServer((req, res) => { | ||
const { name } = url.parse(req.url, true).query; | ||
res.statusCode = 200; | ||
res.setHeader("Content-Type", "text/plain"); | ||
res.setHeader("Access-Control-Allow-Origin", "*"); | ||
res.end(greet(name)); | ||
}); | ||
|
||
const port = 3000; | ||
server.listen(port, () => { | ||
console.log(`Server listening on ${port}`); | ||
}); |
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,5 @@ | ||
const assert = require("assert").strict; | ||
const greet = require("./greet"); | ||
|
||
assert.strictEqual(greet(), "Hello student"); | ||
assert.strictEqual(greet("Guy"), "Hello Guy"); |