Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update starter project #1

Merged
merged 5 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,106 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.odo/odo-file-index.json
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this vscode specific metadata file which has environment specific port number info supposed to be part of the project?

Copy link
Author

@skoh7645 skoh7645 Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had this file in the Appsody nodejs templates, we thought it might be easier for the user as they wouldn't have to create it themselves. But i do see where you are coming from and we should keep it uniform across all stack starter projects so we've removed it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting one.. User will need to know reoteRoot path to eb able to setup this themselves.
@elsony do we document this somewhere today? I remember there was a field added to 2.0 spec for pointing to stack documentation. Should we look to use that for capturing such info?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attach config doesn't actually require the remoteRoot path, it is enough to give it the correct port, I was just trying to be "helpful". For example, the following debugging config also works for me:

    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "port": 5858,
        }
    ]
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That config is largely generated by vscode, I just changed the request from "launch" to "attach" and added the port

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neeraj-laad For your question on doc, any stack/devfile specific doc should go to the website under the metadata on a devfile. For info specific to the starter project, it should go to the README file in the project.

"version": "0.2.0",
"configurations": [
{
"name": "Attach node debugger",
"type": "node",
"request": "attach",
"restart": true,
"port": 5858,
"remoteRoot": "/projects/nodejs-starter",
"localRoot": "${workspaceFolder}",
"protocol": "inspector"
}
]
}
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# web-nodejs-sample
# nodejs-starter

ExpressJS Sample Application
This is a sample starter project that provides you with a basic Express app and a sample test in a `/test` sub directory. This sample project uses `Express v4.17.x` and enables health checking and application metrics out of the box. You can override or enhance the following endpoints by configuring your own health checks in your application.

# Developer Workspace
[![Contribute](http://beta.codenvy.com/factory/resources/codenvy-contribute.svg)](http://beta.codenvy.com/f?id=r8et9w6vohmqvro8)
## Health checking

# Stack to use
Health-checking enables the cloud platform to determine the `readiness` and `liveness` of your application.

FROM [codenvy/node](https://hub.docker.com/r/codenvy/node/)
These endpoints will be available for you to use:

# How to run
- Readiness endpoint: http://localhost:3000/ready
- Liveness endpoint: http://localhost:3000/live

| # | Description | Command |
| :------------- |:-------------| :-----|
| 1 | Run | `cd ${current.project.path}/app && node app.js` |
## Application metrics

The [prom-client](https://www.npmjs.com/package/prom-client) module will collect a wide range of resource-centric (CPU, memory) and application-centric (HTTP request responsiveness) metrics from your application, and then expose them as multi-dimensional time-series data through an application endpoint for Prometheus to scrape and aggregate.

This endpoints will be available for you to use:

- Metrics endpoint: http://localhost:3000/metrics

## License

This stack is licensed under the [EPL 2.0](./LICENSE) license.
24 changes: 0 additions & 24 deletions app/app.js

This file was deleted.

126 changes: 111 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading