mirror of https://github.com/knative/docs.git
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:
parent
70ef4e642a
commit
0d0f53a0ab
|
@ -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
|
generally more useful if you build them step-by-step. The following instructions
|
||||||
recreate the source files from this folder.
|
recreate the source files from this folder.
|
||||||
|
|
||||||
1. Create a new directory and initalize `npm`. You can accept the defaults, but
|
1. Create a new directory and initalize `npm`.
|
||||||
change the entry point to `app.js` to be consistent with the sample code
|
|
||||||
here.
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm init
|
npm init
|
||||||
|
@ -29,7 +27,7 @@ recreate the source files from this folder.
|
||||||
package name: (helloworld-nodejs)
|
package name: (helloworld-nodejs)
|
||||||
version: (1.0.0)
|
version: (1.0.0)
|
||||||
description:
|
description:
|
||||||
entry point: (index.js) app.js
|
entry point: (index.js)
|
||||||
test command:
|
test command:
|
||||||
git repository:
|
git repository:
|
||||||
keywords:
|
keywords:
|
||||||
|
@ -43,7 +41,7 @@ recreate the source files from this folder.
|
||||||
npm install express --save
|
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
|
```js
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
|
@ -69,9 +67,9 @@ recreate the source files from this folder.
|
||||||
"name": "knative-serving-helloworld",
|
"name": "knative-serving-helloworld",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js"
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
"name": "knative-serving-helloworld",
|
"name": "knative-serving-helloworld",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Simple hello world sample in Node",
|
"description": "Simple hello world sample in Node",
|
||||||
"main": "app.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js"
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|
Loading…
Reference in New Issue