From 8b4a3a157f11897dedf0af2e3f2c6c082b8c1baf Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Thu, 17 Feb 2022 17:17:29 +0530 Subject: [PATCH 1/8] minor: Upgrade Getting Started experience for node Signed-off-by: Vipul Gupta (@vipulgupta2048) --- package.json | 3 ++- repo.yml | 2 +- server.js => src/server.js | 6 +++--- views/index.ejs | 2 +- {public => views/public}/bootstrap.min.css | 0 {public => views/public}/confetti.js | 0 {public => views/public}/favicon.ico | Bin {public => views/public}/logo.svg | 0 {public => views/public}/main.css | 0 9 files changed, 7 insertions(+), 6 deletions(-) rename server.js => src/server.js (77%) rename {public => views/public}/bootstrap.min.css (100%) rename {public => views/public}/confetti.js (100%) rename {public => views/public}/favicon.ico (100%) rename {public => views/public}/logo.svg (100%) rename {public => views/public}/main.css (100%) diff --git a/package.json b/package.json index a8ecaeb..c84eb58 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "1.1.0", "description": "A simple Expressjs Web server on balena", "main": "server.js", + "private": true, "scripts": { - "start": "node server.js" + "start": "node src/server.js" }, "repository": { "type": "git", diff --git a/repo.yml b/repo.yml index bf9ea69..5beeb6b 100644 --- a/repo.yml +++ b/repo.yml @@ -1 +1 @@ -type: generic +type: node diff --git a/server.js b/src/server.js similarity index 77% rename from server.js rename to src/server.js index 3c9e626..1f10f8c 100644 --- a/server.js +++ b/src/server.js @@ -4,13 +4,13 @@ const favicon = require('serve-favicon') const app = express() const PORT = 80 -app.use(favicon(join(__dirname, 'public', 'favicon.ico'))) -app.set('views', join(__dirname, 'views')) +app.use(favicon(join(__dirname, '../views/public', 'favicon.ico'))) +app.set('views', join(__dirname, '../views')) app.set('view engine', 'ejs') // Enable the public directory for resource files app.use('/public', express.static( - join(__dirname, 'public') + join(__dirname, '../views/public') )) // reply to request with the hello world html file diff --git a/views/index.ejs b/views/index.ejs index 215817d..f0e221c 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -22,7 +22,7 @@ - +
diff --git a/public/bootstrap.min.css b/views/public/bootstrap.min.css similarity index 100% rename from public/bootstrap.min.css rename to views/public/bootstrap.min.css diff --git a/public/confetti.js b/views/public/confetti.js similarity index 100% rename from public/confetti.js rename to views/public/confetti.js diff --git a/public/favicon.ico b/views/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to views/public/favicon.ico diff --git a/public/logo.svg b/views/public/logo.svg similarity index 100% rename from public/logo.svg rename to views/public/logo.svg diff --git a/public/main.css b/views/public/main.css similarity index 100% rename from public/main.css rename to views/public/main.css From e76abf2ad4304ab71f52de9cc7eec92916704ef9 Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Sat, 4 Jun 2022 02:06:20 +0530 Subject: [PATCH 2/8] Add docker-compose.yml Signed-off-by: Vipul Gupta (@vipulgupta2048) --- docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..00511b2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "2" + +services: + balena-hello-world: + build: . + ports: + - "80:80" \ No newline at end of file From 97e4858a1fe684435c279953a7c3bb1b988b74f4 Mon Sep 17 00:00:00 2001 From: Flynn Joffray Date: Fri, 3 Jun 2022 13:40:21 -0700 Subject: [PATCH 3/8] changing ejs to render regular html Signed-off-by: Flynn Joffray Change-type: patch --- src/server.js | 7 ++++--- views/{index.ejs => index.html} | 0 2 files changed, 4 insertions(+), 3 deletions(-) rename views/{index.ejs => index.html} (100%) diff --git a/src/server.js b/src/server.js index 1f10f8c..5152aeb 100644 --- a/src/server.js +++ b/src/server.js @@ -4,9 +4,10 @@ const favicon = require('serve-favicon') const app = express() const PORT = 80 -app.use(favicon(join(__dirname, '../views/public', 'favicon.ico'))) -app.set('views', join(__dirname, '../views')) -app.set('view engine', 'ejs') +app.use(favicon(join(__dirname, '..', 'views', 'public', 'favicon.ico'))) +app.set('views', join(__dirname, '..', 'views')) +app.engine('html', require('ejs').renderFile) +app.set('view engine', 'html') // Enable the public directory for resource files app.use('/public', express.static( diff --git a/views/index.ejs b/views/index.html similarity index 100% rename from views/index.ejs rename to views/index.html From 75dd91673897270a44725794a6ccaf55791c6ddf Mon Sep 17 00:00:00 2001 From: Flynn Joffray Date: Fri, 3 Jun 2022 14:03:06 -0700 Subject: [PATCH 4/8] cleaning up directory structure, removing ejs Signed-off-by: Flynn Joffray Change-type: major --- package-lock.json | 110 +-------------------- package.json | 3 +- {views/public => public}/bootstrap.min.css | 0 {views/public => public}/confetti.js | 0 {views/public => public}/favicon.ico | Bin {views => public}/index.html | 0 {views/public => public}/logo.svg | 0 {views/public => public}/main.css | 0 src/server.js | 9 +- 9 files changed, 6 insertions(+), 116 deletions(-) rename {views/public => public}/bootstrap.min.css (100%) rename {views/public => public}/confetti.js (100%) rename {views/public => public}/favicon.ico (100%) rename {views => public}/index.html (100%) rename {views/public => public}/logo.svg (100%) rename {views/public => public}/main.css (100%) diff --git a/package-lock.json b/package-lock.json index c83994c..394597a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-server-node", - "version": "1.1.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -13,29 +13,11 @@ "negotiator": "0.6.2" } }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, "body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -53,48 +35,11 @@ "type-is": "~1.6.17" } }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -141,14 +86,6 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, - "ejs": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", - "requires": { - "jake": "^10.6.1" - } - }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -159,11 +96,6 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", @@ -206,14 +138,6 @@ "vary": "~1.1.2" } }, - "filelist": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", - "requires": { - "minimatch": "^3.0.4" - } - }, "finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -238,11 +162,6 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -273,17 +192,6 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, - "jake": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz", - "integrity": "sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A==", - "requires": { - "async": "0.9.x", - "chalk": "^2.4.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - } - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -317,14 +225,6 @@ "mime-db": "1.48.0" } }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -465,14 +365,6 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", diff --git a/package.json b/package.json index c84eb58..2bc1049 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-server-node", - "version": "1.1.0", + "version": "2.0.0", "description": "A simple Expressjs Web server on balena", "main": "server.js", "private": true, @@ -23,7 +23,6 @@ }, "homepage": "https://github.com/balena-io-projects/simple-server-node#readme", "dependencies": { - "ejs": "~3.1.6", "express": "~4.17.1", "serve-favicon": "~2.5.0" } diff --git a/views/public/bootstrap.min.css b/public/bootstrap.min.css similarity index 100% rename from views/public/bootstrap.min.css rename to public/bootstrap.min.css diff --git a/views/public/confetti.js b/public/confetti.js similarity index 100% rename from views/public/confetti.js rename to public/confetti.js diff --git a/views/public/favicon.ico b/public/favicon.ico similarity index 100% rename from views/public/favicon.ico rename to public/favicon.ico diff --git a/views/index.html b/public/index.html similarity index 100% rename from views/index.html rename to public/index.html diff --git a/views/public/logo.svg b/public/logo.svg similarity index 100% rename from views/public/logo.svg rename to public/logo.svg diff --git a/views/public/main.css b/public/main.css similarity index 100% rename from views/public/main.css rename to public/main.css diff --git a/src/server.js b/src/server.js index 5152aeb..39adf44 100644 --- a/src/server.js +++ b/src/server.js @@ -4,19 +4,18 @@ const favicon = require('serve-favicon') const app = express() const PORT = 80 -app.use(favicon(join(__dirname, '..', 'views', 'public', 'favicon.ico'))) -app.set('views', join(__dirname, '..', 'views')) -app.engine('html', require('ejs').renderFile) +app.use(favicon(join(__dirname, '..', 'public', 'favicon.ico'))) +app.set('views', join(__dirname, '..', 'public')) app.set('view engine', 'html') // Enable the public directory for resource files app.use('/public', express.static( - join(__dirname, '../views/public') + join(__dirname, '..', 'public') )) // reply to request with the hello world html file app.get('/', function (req, res) { - res.render('index') + res.sendFile(join(__dirname, '..', 'public', 'index.html')) }) // start a server on port 80 and log its start to our console From 0d54f3832caf8c9e3121583f8c2793c171ffee79 Mon Sep 17 00:00:00 2001 From: Flynn Joffray Date: Fri, 3 Jun 2022 14:07:40 -0700 Subject: [PATCH 5/8] moving files back into views directory Signed-off-by: Flynn Joffray Change-type: patch --- src/server.js | 8 ++++---- {public => views}/index.html | 0 {public => views/public}/bootstrap.min.css | 0 {public => views/public}/confetti.js | 0 {public => views/public}/favicon.ico | Bin {public => views/public}/logo.svg | 0 {public => views/public}/main.css | 0 7 files changed, 4 insertions(+), 4 deletions(-) rename {public => views}/index.html (100%) rename {public => views/public}/bootstrap.min.css (100%) rename {public => views/public}/confetti.js (100%) rename {public => views/public}/favicon.ico (100%) rename {public => views/public}/logo.svg (100%) rename {public => views/public}/main.css (100%) diff --git a/src/server.js b/src/server.js index 39adf44..f4c9a40 100644 --- a/src/server.js +++ b/src/server.js @@ -4,18 +4,18 @@ const favicon = require('serve-favicon') const app = express() const PORT = 80 -app.use(favicon(join(__dirname, '..', 'public', 'favicon.ico'))) -app.set('views', join(__dirname, '..', 'public')) +app.use(favicon(join(__dirname, '..', 'views', 'public', 'favicon.ico'))) +app.set('views', join(__dirname, '..', 'views', 'public')) app.set('view engine', 'html') // Enable the public directory for resource files app.use('/public', express.static( - join(__dirname, '..', 'public') + join(__dirname, '..', 'views', 'public') )) // reply to request with the hello world html file app.get('/', function (req, res) { - res.sendFile(join(__dirname, '..', 'public', 'index.html')) + res.sendFile(join(__dirname, '..', 'views', 'index.html')) }) // start a server on port 80 and log its start to our console diff --git a/public/index.html b/views/index.html similarity index 100% rename from public/index.html rename to views/index.html diff --git a/public/bootstrap.min.css b/views/public/bootstrap.min.css similarity index 100% rename from public/bootstrap.min.css rename to views/public/bootstrap.min.css diff --git a/public/confetti.js b/views/public/confetti.js similarity index 100% rename from public/confetti.js rename to views/public/confetti.js diff --git a/public/favicon.ico b/views/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to views/public/favicon.ico diff --git a/public/logo.svg b/views/public/logo.svg similarity index 100% rename from public/logo.svg rename to views/public/logo.svg diff --git a/public/main.css b/views/public/main.css similarity index 100% rename from public/main.css rename to views/public/main.css From b5ea200da2da4cce1d11dfe45adbc6a957f0e984 Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Sat, 4 Jun 2022 02:35:02 +0530 Subject: [PATCH 6/8] Update README to latest spec Signed-off-by: Vipul Gupta (@vipulgupta2048) --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e8593a9..d224d1a 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,25 @@ [![balena deploy button](https://www.balena.io/deploy.svg)](https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/balena-io-examples/balena-node-hello-world) -This is a simple skeleton Express server project that works on any of the [balena][balena-link] supported devices. +This is a simple skeleton NodeJS server project that works on any of the [devices supported][devices-supported] by [balena][balena-link]. This project serves up a welcome page on port `:80` of your balena device. -To get this project up and running, you will need to signup for a balena account [here][signup-page] and set up an application and device. You'll find full details in our [Getting Started tutorial][gettingStarted-link]. +To get this project up and running, you will need to [sign-up][signup-page] for a balena account. Have a look at our [Getting Started tutorial][gettingStarted-link] to help you kickstart your journey in creating a fleet of devices. Once you are set up with balena, you will need to clone or download this repository. -Once you have downloaded this project, you can `balena push` it using the [balenaCLI][balena-cli]. This command will package up and push the code to the balena builders, where it will be compiled and built and deployed to every device in the application fleet. When it completes, you'll have a node.js web server running on your device and see some logs on your [balenaCloud dashboard][balena-dashboard]. +After downloading, navigate to the directory and run the `balena push` command using the [balena CLI][balena-cli]. This command will package up and push the code to the balena builders, where it will be compiled, built and deployed to every device in the fleet. When it completes, you'll have a NodeJS powered web server running on your device and you can see some logs on your [device dashboard][balena-dashboard]. -To give your device a public URL, access the device page on the [balenaCloud dashboard][balena-dashboard], and choose the _Public Device URL_ toggle. Alternatively, you can point your browser to your device's IP address. +```bash +cd balena-nodejs-hello-world/ +balena push +``` -[balena-link]:https://balena.io/ +To give your device a public URL, access the device page on the [balenaCloud dashboard][balena-dashboard], and choose the _Public Device URL_ toggle. Once the device is updated, check the Public Device URL to find the welcome page showing up from your device. That's it, you have deployed your first balena device! + + +[balena-link]:https://balena.io/ [signup-page]:https://dashboard.balena-cloud.com/signup -[gettingStarted-link]:http://balena.io/docs/learn/getting-started/ +[gettingStarted-link]:https://www.balena.io/docs/learn/getting-started/raspberrypi3/NodeJS/ [balena-cli]:https://www.balena.io/docs/reference/cli/ [balena-dashboard]:https://dashboard.balena-cloud.com/ +[devices-supported]:https://www.balena.io/docs/reference/hardware/devices/ From fe74542f331985e65c3b08b3b85a76e47c5ac6db Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Sat, 4 Jun 2022 03:40:02 +0530 Subject: [PATCH 7/8] Add balena.yml file Signed-off-by: Vipul Gupta (@vipulgupta2048) --- README.md | 8 ++++---- balena.yml | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 balena.yml diff --git a/README.md b/README.md index d224d1a..165ab66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# A Simple Server with Node.js Express +# A Simple Server with NodeJS Express [![balena deploy button](https://www.balena.io/deploy.svg)](https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/balena-io-examples/balena-node-hello-world) @@ -18,9 +18,9 @@ balena push To give your device a public URL, access the device page on the [balenaCloud dashboard][balena-dashboard], and choose the _Public Device URL_ toggle. Once the device is updated, check the Public Device URL to find the welcome page showing up from your device. That's it, you have deployed your first balena device! -[balena-link]:https://balena.io/ -[signup-page]:https://dashboard.balena-cloud.com/signup -[gettingStarted-link]:https://www.balena.io/docs/learn/getting-started/raspberrypi3/NodeJS/ [balena-cli]:https://www.balena.io/docs/reference/cli/ [balena-dashboard]:https://dashboard.balena-cloud.com/ +[balena-link]:https://balena.io/ [devices-supported]:https://www.balena.io/docs/reference/hardware/devices/ +[gettingStarted-link]:https://www.balena.io/docs/learn/getting-started/raspberrypi3/NodeJS/ +[signup-page]:https://dashboard.balena-cloud.com/signup diff --git a/balena.yml b/balena.yml new file mode 100644 index 0000000..05ef219 --- /dev/null +++ b/balena.yml @@ -0,0 +1,16 @@ +name: balena-nodejs-hello-world +type: sw.application +description: >- + This is a simple skeleton NodeJS server that works on any of the devices supported by balena. It also serves as a boilerplate project for you to get started on building your fleet. Have fun! +post-provisioning: >- + ## Usage instructions + + Allow a few minutes for your device to download the app. Once it's completed, + the welcome page should be accessible on the public device URL. +assets: + repository: + type: blob.asset + data: + url: 'https://github.com/balena-io-examples/balena-nodejs-hello-world/' +data: + From 5809ff3c2dbf55d0c2b3b5d5fdda99a4c5fe3b9b Mon Sep 17 00:00:00 2001 From: "Vipul Gupta (@vipulgupta2048)" Date: Sat, 4 Jun 2022 03:58:46 +0530 Subject: [PATCH 8/8] Add license file Signed-off-by: Vipul Gupta (@vipulgupta2048) --- license.md | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 202 insertions(+) create mode 100644 license.md diff --git a/license.md b/license.md new file mode 100644 index 0000000..0d381b2 --- /dev/null +++ b/license.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/package.json b/package.json index 2bc1049..31cb04b 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "server.js", "private": true, "scripts": { + "test" : "echo \"Error: no test specified\"", "start": "node src/server.js" }, "repository": {