Node.js sample: Use index.js instead of app.js. (#849)

* Use index.js instead of app.js.

index.js is the more idiomatic for Node.js developers.
Indeed, it is the default value that npm start uses if no start script is provided.

* Update package.json

* Update README.md

* Update package.json
This commit is contained in:
Steren 2019-01-31 10:35:37 -08:00 committed by Knative Prow Robot
parent 70ef4e642a
commit 0d0f53a0ab
3 changed files with 7 additions and 9 deletions

View File

@ -19,9 +19,7 @@ While you can clone all of the code from this directory, hello world apps are
generally more useful if you build them step-by-step. The following instructions
recreate the source files from this folder.
1. Create a new directory and initalize `npm`. You can accept the defaults, but
change the entry point to `app.js` to be consistent with the sample code
here.
1. Create a new directory and initalize `npm`.
```shell
npm init
@ -29,7 +27,7 @@ recreate the source files from this folder.
package name: (helloworld-nodejs)
version: (1.0.0)
description:
entry point: (index.js) app.js
entry point: (index.js)
test command:
git repository:
keywords:
@ -43,7 +41,7 @@ recreate the source files from this folder.
npm install express --save
```
1. Create a new file named `app.js` and paste the following code:
1. Create a new file named `index.js` and paste the following code:
```js
const express = require("express");
@ -69,9 +67,9 @@ recreate the source files from this folder.
"name": "knative-serving-helloworld",
"version": "1.0.0",
"description": "",
"main": "app.js",
"main": "index.js",
"scripts": {
"start": "node app.js"
"start": "node index.js"
},
"author": "",
"license": "Apache-2.0",

View File

@ -2,9 +2,9 @@
"name": "knative-serving-helloworld",
"version": "1.0.0",
"description": "Simple hello world sample in Node",
"main": "app.js",
"main": "index.js",
"scripts": {
"start": "node app.js"
"start": "node index.js"
},
"author": "",
"license": "Apache-2.0",