Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mies/getting-started-nodejs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: kumarnishant/getting-started-nodejs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on May 24, 2013

  1. Procfile for heroku

    wwwouter committed May 24, 2013
    Copy the full SHA
    6652710 View commit details

Commits on Jun 11, 2013

  1. added city

    mies committed Jun 11, 2013
    Copy the full SHA
    c719668 View commit details
  2. Copy the full SHA
    c3d0c0b View commit details

Commits on Jun 17, 2013

  1. added gitignore

    mies committed Jun 17, 2013
    Copy the full SHA
    1de0029 View commit details

Commits on Mar 4, 2015

  1. updated yml

    mies committed Mar 4, 2015
    Copy the full SHA
    93c58a4 View commit details
  2. update

    mies committed Mar 4, 2015
    Copy the full SHA
    9c70f6f View commit details
  3. nodesource

    mies committed Mar 4, 2015
    Copy the full SHA
    d173fbc View commit details

Commits on Mar 9, 2015

  1. Update README.md

    Micha Hernandez van Leuffen committed Mar 9, 2015
    Copy the full SHA
    5cec39c View commit details

Commits on Apr 3, 2015

  1. Update README.md

    Micha Hernandez van Leuffen committed Apr 3, 2015
    Copy the full SHA
    7e3c197 View commit details

Commits on Apr 13, 2015

  1. add NODE_ENV

    flenter committed Apr 13, 2015
    Copy the full SHA
    1a17055 View commit details

Commits on May 11, 2015

  1. devclause for wercker.yml

    mies committed May 11, 2015
    Copy the full SHA
    89ba189 View commit details
  2. added gitignore

    mies committed May 11, 2015
    Copy the full SHA
    6f156b4 View commit details
  3. added devclause

    mies committed May 11, 2015
    Copy the full SHA
    ca16d5f View commit details
  4. Merge pull request #1 from wercker/devclause

    Devclause
    Micha Hernandez van Leuffen committed May 11, 2015
    Copy the full SHA
    aec7f13 View commit details

Commits on May 15, 2015

  1. added city

    mies committed May 15, 2015
    Copy the full SHA
    fe26c49 View commit details
  2. Merge pull request #2 from wercker/devclause

    added city
    Micha Hernandez van Leuffen committed May 15, 2015
    Copy the full SHA
    24d523f View commit details

Commits on Feb 3, 2016

  1. Using node slim and mocha from bin

    - [x] Uses node slim docker image version 4.2.6
    - [x] Uses mocha from node_modules/mocha/bin not global
    Geshan Manandhar committed Feb 3, 2016
    Copy the full SHA
    5db3f5e View commit details

Commits on Feb 21, 2016

  1. Merge pull request #4 from geshan/master

    Using node slim and mocha from bin
    toonverbeek committed Feb 21, 2016
    Copy the full SHA
    0432217 View commit details

Commits on Aug 29, 2017

  1. Update to use --expose-ports

    cg14823 committed Aug 29, 2017
    Copy the full SHA
    ba5ba9b View commit details

Commits on Oct 2, 2017

  1. Updated for OOW

    rikgibson committed Oct 2, 2017
    Copy the full SHA
    e00a39e View commit details
  2. Copy the full SHA
    37e1696 View commit details

Commits on Oct 3, 2017

  1. Update README.md

    rikgibson authored Oct 3, 2017
    Copy the full SHA
    d421669 View commit details
  2. Update README.md

    rikgibson authored Oct 3, 2017
    Copy the full SHA
    43e4543 View commit details
  3. Update app.js

    rikgibson authored Oct 3, 2017
    Copy the full SHA
    76d249d View commit details
  4. Merge pull request #7 from wercker/update-code-and-readme-for-oow

    Update code and readme for oow
    rikgibson authored Oct 3, 2017
    Copy the full SHA
    b3ba8e6 View commit details

Commits on Oct 5, 2017

  1. Sorted cities array

    rikgibson committed Oct 5, 2017
    Copy the full SHA
    e3b5757 View commit details

Commits on Oct 6, 2017

  1. Merge pull request #9 from wercker/sorted-cities-array

    Sorted cities array
    rikgibson authored Oct 6, 2017
    Copy the full SHA
    ae3db32 View commit details

Commits on Apr 28, 2018

  1. Adding CONTRIBUTING.md

    gilbode committed Apr 28, 2018
    Copy the full SHA
    52723d7 View commit details
  2. Writing CONTRIBUTING.md

    gilbode committed Apr 28, 2018
    Copy the full SHA
    de81432 View commit details

Commits on Jun 11, 2019

  1. dockerfile added

    nishant-d committed Jun 11, 2019
    Copy the full SHA
    8870567 View commit details

Commits on Jul 2, 2019

  1. Update README.md

    kumarnishant authored Jul 2, 2019
    Copy the full SHA
    ef396e5 View commit details
  2. Update README.md

    kumarnishant authored Jul 2, 2019
    Copy the full SHA
    7f60e66 View commit details

Commits on Jul 3, 2019

  1. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    ca6afe0 View commit details
  2. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    ad7863c View commit details
  3. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    c41776e View commit details
  4. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    cd31afe View commit details
  5. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    15085a8 View commit details
  6. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    7ce3860 View commit details
  7. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    809efc3 View commit details
  8. Update README.md

    kumarnishant authored Jul 3, 2019
    Copy the full SHA
    cbf085c View commit details

Commits on Jul 6, 2019

  1. Update README.md

    kumarnishant authored Jul 6, 2019
    Copy the full SHA
    86ac954 View commit details

Commits on Jul 15, 2019

  1. Update README.md

    kumarnishant authored Jul 15, 2019
    Copy the full SHA
    06b1afe View commit details

Commits on Jul 17, 2019

  1. ci test

    Suraj Gupta committed Jul 17, 2019
    Copy the full SHA
    8c0d614 View commit details
  2. Update README.md

    kumarnishant authored Jul 17, 2019
    Copy the full SHA
    1e73001 View commit details
  3. Copy the full SHA
    6589034 View commit details
  4. Update README.md

    kumarnishant authored Jul 17, 2019
    Copy the full SHA
    7d40754 View commit details
  5. polling test suraj

    Suraj Gupta committed Jul 17, 2019
    Copy the full SHA
    39e5226 View commit details
  6. Copy the full SHA
    48a6d51 View commit details
  7. polling test suraj 2

    Suraj Gupta committed Jul 17, 2019
    Copy the full SHA
    9744586 View commit details
  8. polling test suraj 3

    Suraj Gupta committed Jul 17, 2019
    Copy the full SHA
    5e1bcba View commit details
Showing with 289 additions and 23 deletions.
  1. +3 −0 .gitignore
  2. +45 −0 CONTRIBUTING.md
  3. +11 −0 Dockerfile
  4. +46 −3 README.md
  5. +40 −5 app.js
  6. +21 −0 azure-pipelines-1.yml
  7. +21 −0 azure-pipelines.yml
  8. +56 −0 devtron-ci.yaml
  9. +14 −14 package.json
  10. +1 −1 test/test.js
  11. +31 −0 wercker.yml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.wercker
node_modules
package-lock.json
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing

Oracle welcomes contributions to this repository from anyone.

If you want to submit a pull request to fix a bug or enhance an existing
feature, please first open an issue and link to that issue when you
submit your pull request.

If you have any questions about a possible submission, feel free to open
an issue too.

## Contributing to this repository

Pull requests can be made under
[The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html) (OCA).

For pull requests to be accepted, the bottom of your commit message must have
the following line using your name and e-mail address as it appears in the
OCA Signatories list.

```
Signed-off-by: Your Name <you@example.org>
```

This can be automatically added to pull requests by committing with:

```
git commit --signoff
```

Only pull requests from committers that can be verified as having
signed the OCA can be accepted.

### Pull request process

1. Fork this repository
1. Create a branch in your fork to implement the changes. We recommend using
the issue number as part of your branch name, e.g. `1234-fixes`
1. Ensure that any documentation is updated with the changes that are required test
by your fix.
1. Ensure that any samples are updated if the base image has been changed.
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
what your changes are meant to do and provide simple steps on how to validate
your changes. Ensure that you reference the issue you created as well.
We will assign the pull request to 2-3 people for review before it is merged.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node

ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

COPY /. .
RUN npm install

CMD ["node","app.js"]
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
Node.js sample application for wercker built with Express
# getting-started-nodejs

[![Wercker
status](https://app.wercker.com/status/7b1a402dd00d57fc9abddf9eb5161675/m)](https://app.wercker.com/project/bykey/7b1a402dd00d57fc9abddf9eb5161675)
[![wercker status](https://app.wercker.com/status/7b1a402dd00d57fc9abddf9eb5161675/s "wercker status")](https://app.wercker.com/project/bykey/7b1a402dd00d57fc9abddf9eb5161675)
ample application in Javascript on NodeJS for Wercker

This application uses the `node` container obtained from the [Docker Hub](https://hub.docker.com/_/node/)

## Setup
lone this repo and cd into the directory:

```
git clone https://github.com/wercker/getting-started-nodejs.git
cd getting-started-nodejs
```

## Running
You can run the sample app in a couple of different ways. The first is to simply launch the executable:
```
node app.js
```

Now point your browser at `http://localhost:8080` to see:
```
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo"]}
```

The second, and more useful, way is to use the `wercker dev` command to launch the binary within a Docker container, using the base image defined in the `box/id` property at the top of the `wercker.yml`, like so:
```
wercker dev --expose-ports
```
The `dev` target inside `wercker.yml` uses the `internal/watch` step to dynamically reload the runtime container when sourcefile changes are detected, which allows you to quickly test changes without having to kill/rebuild/relaunch the container. For instance, add another city to the array on `app.js:3' like so:

```
var cities = {"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}
```

and then refresh your browser pointing to `http://localhost:8080` to see:
```
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}}
```

---
Sign up for Wercker: http://www.wercker.com

Learn more at: http://devcenter.wercker.com
17
18

45 changes: 40 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
var express = require('express');
var app = express();

app.get('/cities.json', function(req, res){
var cities = {cities:["Amsterdam","Berlin","New York","San Francisco","Tokyo", "Delhi"]}
var text1 = makeid(40);
var text2 = text1+ " "+makeid(40);
var text3 = text2+ " "+makeid(40);
var text4 = text3+ " "+makeid(40);
var logs = ["i 1", "am 1", "here 1", "hello 1", "and 1", "you 1", "know 1", "who 1", "i 2", "am 2", "here 2", "hello 2", "hello 2", "and 2", "you 2", "know 2", "who 2", "i 3", "am 3", "here 3", "hello 3", "and 3", "hello 3", "and 3", "you 3", "know 3", "who 3", "i 4", "am 4", "here 4", "hello 4", "and 4", "we 4", "hello 4", "and 4", "you 4", "know 4", "who 4", "i 5", "am 5", "here 5", "hello 5", "or 5", "not 5", "and 5", "we 5", "hello 5", "and 5", "you 5", "know 5", "who 5", "i 6", "am 6", "here 6", "hello 6", "or 6", "not 6", "and 6", "hello 6", "and 6", "you 6", "know 6", "who 6", "i 7", "am 7", "here 7", "hello 7", "and 7", "we 7", "are 7", "here1 7", "hello 7", "and 7", "you 7", "know 7", "who 7", "i 8", "am 8", "here 8", "hello 8", "and 8", "we 8", "miss 8", "are 8", "here1 8", "hello 8", "and 8", "you 8", "know 8", "who 8"]
var i = 0
app.get('/', function(req, res){
res.writeHead(200, { 'Content-Type': 'application/json' });
res.write(JSON.stringify({insecticons : ["San Francisco","Amsterdam", "Berlin", "New York"]}));
res.write(JSON.stringify(cities));
res.end();
});

var port = process.env.PORT || 5000;
app.get("/error", (req, res) => {
res.writeHead(500, { 'Content-Type': 'application/json' });
res.end();
})
app.get('/health', (req, res) => res.send({"status": "OK", "time": new Date()}))
var port = process.env.PORT || 8080;
app.listen(port);

setInterval(function(str1, str2) {
var text = makeid(40);
var ran = Math.random()
if (ran > 0.75)
text = makeid(40)+ ""+makeid(40)+ ""+makeid(40)+ ""+makeid(40)
else if (ran > 0.5)
text = makeid(40)+ ""+makeid(40)+ ""+makeid(40)
else if (ran > 0.25)
text = makeid(40)+ ""+makeid(40)
//console.log(str1 + "" + str2 + "" + text+ "" +makeid(40) + "args2" + process.argv);
console.log(logs[i])
i++
if (i == logs.length) i = 0
}, 1, "Hello.", "How are you?");

function makeid(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));

return text;
}
//just a comment
module.exports = app;
21 changes: 21 additions & 0 deletions azure-pipelines-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
displayName: 'npm install and build'
21 changes: 21 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
displayName: 'npm install and build'
56 changes: 56 additions & 0 deletions devtron-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: 0.0.1
pipelineConf:
- appliesTo:
- type: BRANCH_FIXED
value:
- master
- type: TAG_PATTERN
value:
- "%d.%d.%d-rc"
- ".*-rc"
beforeDockerBuildStages:
- name: "test-1"
script: |
date > test.report
echo 'hello'
outputLocation: "./test.report"
- name: "test-2"
script: |
date > test2.report
outputLocation: "./test2.report"
afterDockerBuildStages:
- name: "test-3"
script: |
date > test3.report
echo 'hello'
outputLocation: "./test3.report"
- name: "test-4"
script: |
date > test4.report
outputLocation: "./test4.report"
- name: "test-5"
script: |
apk add lua5.3
apk add lua5.3-dev
echo 'print("Hello World")' > hello.lua
lua5.3 hello.lua > test5.txt
outputLocation: "./test5.txt"
- appliesTo:
- type: BRANCH_FIXED
value:
- qa
- type: TAG_PATTERN
value:
- "%d.%d.%d-rc"
beforeDockerBuildStages:
- name: "stage2-test-1"
script: |
date > test5.report
echo 'hello'
outputLocation: "./test5.report"
afterDockerBuildStages:
- name: "stage2-test-2"
script: |
date > test6.report
echo 'hello'
outputLocation: "./test6.report"
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "getting-started-nodejs",
"version": "0.0.1",
"engines" : {
"name": "getting-started-nodejs",
"version": "0.0.1",
"engines": {
"node": "0.6.x"
},
"dependencies": {
"express": "3.x",
"nodeunit": "0.7.4",
"supertest" : "0.4.0",
"mocha" : "1.6.0"
},
"scripts": {
"test": "mocha",
"start": "app.js"
}
},
"dependencies": {
"express": "3.x",
"nodeunit": "0.7.4",
"supertest": "0.4.0",
"mocha": "1.6.0"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha",
"start": "app.js"
}
}
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
describe('GET', function(){
it('respond with json', function(done){
request(app)
.get('/cities.json')
.get('/')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
31 changes: 31 additions & 0 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
box:
id: node:latest
ports:
- "8080"

dev:
steps:
- npm-install
- internal/watch:
code: node app.js
reload: true

# Build definition
build:
# The steps that will be executed on build
steps:
- script:
code: export NODE_ENV='testing'
# A step that executes `npm install` command
- npm-install
# A step that executes `npm test` command
- npm-test

# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: echo nodejs information
code: |
echo "node version $(node -v) running"
echo "npm version $(npm -v) running"