diff --git a/serving/samples/helloworld-csharp/README.md b/serving/samples/helloworld-csharp/README.md index b88936192de..4dbdc96a0f4 100644 --- a/serving/samples/helloworld-csharp/README.md +++ b/serving/samples/helloworld-csharp/README.md @@ -40,8 +40,8 @@ recreate the source files from this folder. ```csharp app.Run(async (context) => { - var target = Environment.GetEnvironmentVariable("TARGET") ?? "NOT SPECIFIED"; - await context.Response.WriteAsync($"Hello World: {target}\n"); + var target = Environment.GetEnvironmentVariable("TARGET") ?? "World"; + await context.Response.WriteAsync($"Hello {target}\n"); }); ``` diff --git a/serving/samples/helloworld-csharp/Startup.cs b/serving/samples/helloworld-csharp/Startup.cs index 2a4151afb09..c2bc13438ba 100644 --- a/serving/samples/helloworld-csharp/Startup.cs +++ b/serving/samples/helloworld-csharp/Startup.cs @@ -27,8 +27,8 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.Run(async (context) => { - var target = Environment.GetEnvironmentVariable("TARGET") ?? "NOT SPECIFIED"; - await context.Response.WriteAsync($"Hello World: {target}\n"); + var target = Environment.GetEnvironmentVariable("TARGET") ?? "World"; + await context.Response.WriteAsync($"Hello {target}\n"); }); } } diff --git a/serving/samples/helloworld-go/README.md b/serving/samples/helloworld-go/README.md index 2c1d1f55b75..3ce16f29c98 100644 --- a/serving/samples/helloworld-go/README.md +++ b/serving/samples/helloworld-go/README.md @@ -36,9 +36,9 @@ following instructions recreate the source files from this folder. log.Print("Hello world received a request.") target := os.Getenv("TARGET") if target == "" { - target = "NOT SPECIFIED" + target = "World" } - fmt.Fprintf(w, "Hello World: %s!\n", target) + fmt.Fprintf(w, "Hello %s!\n", target) } func main() { diff --git a/serving/samples/helloworld-go/helloworld.go b/serving/samples/helloworld-go/helloworld.go index c845ea9a214..c7a252267b5 100644 --- a/serving/samples/helloworld-go/helloworld.go +++ b/serving/samples/helloworld-go/helloworld.go @@ -27,9 +27,9 @@ func handler(w http.ResponseWriter, r *http.Request) { log.Print("Hello world received a request.") target := os.Getenv("TARGET") if target == "" { - target = "NOT SPECIFIED" + target = "World" } - fmt.Fprintf(w, "Hello World: %s!\n", target) + fmt.Fprintf(w, "Hello %s!\n", target) } func main() { diff --git a/serving/samples/helloworld-haskell/README.md b/serving/samples/helloworld-haskell/README.md index 5cf860ab0d2..02299acac01 100644 --- a/serving/samples/helloworld-haskell/README.md +++ b/serving/samples/helloworld-haskell/README.md @@ -64,14 +64,14 @@ following instructions recreate the source files from this folder. main :: IO () main = do - t <- fromMaybe "NOT SPECIFIED" <$> lookupEnv "TARGET" + t <- fromMaybe "World" <$> lookupEnv "TARGET" scotty 8080 (route t) route :: String -> ScottyM() route t = get "/" $ hello t hello :: String -> ActionM() - hello t = text $ pack ("Hello world: " ++ t) + hello t = text $ pack ("Hello " ++ t) ``` 1. In your project directory, create a file named `Dockerfile` and copy the code diff --git a/serving/samples/helloworld-haskell/app/Main.hs b/serving/samples/helloworld-haskell/app/Main.hs index 6f69ab9cee7..b16fc5f6a6d 100644 --- a/serving/samples/helloworld-haskell/app/Main.hs +++ b/serving/samples/helloworld-haskell/app/Main.hs @@ -10,11 +10,11 @@ import Web.Scotty.Trans main :: IO () main = do - t <- fromMaybe "NOT SPECIFIED" <$> lookupEnv "TARGET" + t <- fromMaybe "World" <$> lookupEnv "TARGET" scotty 8080 (route t) route :: String -> ScottyM() route t = get "/" $ hello t hello :: String -> ActionM() -hello t = text $ pack ("Hello world: " ++ t) +hello t = text $ pack ("Hello " ++ t) diff --git a/serving/samples/helloworld-java/README.md b/serving/samples/helloworld-java/README.md index b3845b8059c..38c62c55a85 100644 --- a/serving/samples/helloworld-java/README.md +++ b/serving/samples/helloworld-java/README.md @@ -52,14 +52,14 @@ recreate the source files from this folder. @SpringBootApplication public class HelloworldApplication { - @Value("${TARGET:NOT SPECIFIED}") + @Value("${TARGET:World}") String target; @RestController class HelloworldController { @GetMapping("/") String hello() { - return "Hello World: " + target; + return "Hello " + target; } } diff --git a/serving/samples/helloworld-java/src/main/java/com/example/helloworld/HelloworldApplication.java b/serving/samples/helloworld-java/src/main/java/com/example/helloworld/HelloworldApplication.java index 1151719e3a0..bfc48a6c88e 100644 --- a/serving/samples/helloworld-java/src/main/java/com/example/helloworld/HelloworldApplication.java +++ b/serving/samples/helloworld-java/src/main/java/com/example/helloworld/HelloworldApplication.java @@ -9,14 +9,14 @@ @SpringBootApplication public class HelloworldApplication { - @Value("${TARGET:NOT SPECIFIED}") + @Value("${TARGET:World}") String message; @RestController class HelloworldController { @GetMapping("/") String hello() { - return "Hello World: " + message; + return "Hello " + message; } } diff --git a/serving/samples/helloworld-nodejs/Dockerfile b/serving/samples/helloworld-nodejs/Dockerfile index 5685f4761c6..50a9ec78c3d 100644 --- a/serving/samples/helloworld-nodejs/Dockerfile +++ b/serving/samples/helloworld-nodejs/Dockerfile @@ -9,8 +9,6 @@ WORKDIR /usr/src/app COPY package*.json ./ RUN npm install --only=production -# If you are building your code for production -# RUN npm install --only=production # Bundle app source COPY . . diff --git a/serving/samples/helloworld-nodejs/README.md b/serving/samples/helloworld-nodejs/README.md index dab4feec228..e981f0c5686 100644 --- a/serving/samples/helloworld-nodejs/README.md +++ b/serving/samples/helloworld-nodejs/README.md @@ -52,8 +52,8 @@ recreate the source files from this folder. app.get('/', function (req, res) { console.log('Hello world received a request.'); - var target = process.env.TARGET || 'NOT SPECIFIED'; - res.send('Hello world: ' + target); + var target = process.env.TARGET || 'World'; + res.send('Hello ' + target); }); var port = 8080; @@ -71,8 +71,7 @@ recreate the source files from this folder. "description": "", "main": "app.js", "scripts": { - "start": "node app.js", - "test": "echo \"Error: no test specified\" && exit 1" + "start": "node app.js" }, "author": "", "license": "Apache-2.0" @@ -94,9 +93,7 @@ recreate the source files from this folder. # where available (npm@5+) COPY package*.json ./ - RUN npm install - # If you are building your code for production - # RUN npm install --only=production + RUN npm install --only=production # Bundle app source COPY . . diff --git a/serving/samples/helloworld-nodejs/app.js b/serving/samples/helloworld-nodejs/app.js index d984c1ff088..e9ad188cc16 100644 --- a/serving/samples/helloworld-nodejs/app.js +++ b/serving/samples/helloworld-nodejs/app.js @@ -20,8 +20,8 @@ const app = express(); app.get('/', function (req, res) { console.log('Hello world received a request.'); - var target = process.env.TARGET || 'NOT SPECIFIED'; - res.send('Hello world: ' + target); + var target = process.env.TARGET || 'World'; + res.send('Hello ' + target); }); var port = 8080; diff --git a/serving/samples/helloworld-nodejs/package.json b/serving/samples/helloworld-nodejs/package.json index 7a0f72e70d4..eb1064bf9dc 100644 --- a/serving/samples/helloworld-nodejs/package.json +++ b/serving/samples/helloworld-nodejs/package.json @@ -4,12 +4,11 @@ "description": "Simple hello world sample in Node", "main": "app.js", "scripts": { - "start": "node app.js", - "test": "echo \"Error: no test specified\" && exit 1" + "start": "node app.js" }, "repository": { "type": "git", - "url": "git+https://github.com/knative/serving.git" + "url": "git+https://github.com/knative/docs.git" }, "author": "", "license": "Apache-2.0", diff --git a/serving/samples/helloworld-php/README.md b/serving/samples/helloworld-php/README.md index 90c799e3e6f..b9303062f0c 100644 --- a/serving/samples/helloworld-php/README.md +++ b/serving/samples/helloworld-php/README.md @@ -29,8 +29,8 @@ following instructions recreate the source files from this folder. ```php ``` diff --git a/serving/samples/helloworld-php/index.php b/serving/samples/helloworld-php/index.php index 5ddf1277f44..c352fef5172 100644 --- a/serving/samples/helloworld-php/index.php +++ b/serving/samples/helloworld-php/index.php @@ -1,4 +1,4 @@ diff --git a/serving/samples/helloworld-python/README.md b/serving/samples/helloworld-python/README.md index 25b1171f825..b95b80f3b77 100644 --- a/serving/samples/helloworld-python/README.md +++ b/serving/samples/helloworld-python/README.md @@ -35,8 +35,8 @@ The following instructions recreate the source files from this folder. @app.route('/') def hello_world(): - target = os.environ.get('TARGET', 'NOT SPECIFIED') - return 'Hello World: {}!\n'.format(target) + target = os.environ.get('TARGET', 'World') + return 'Hello {}!\n'.format(target) if __name__ == "__main__": app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080))) diff --git a/serving/samples/helloworld-python/app.py b/serving/samples/helloworld-python/app.py index 4bb6af7524a..de64bd6bfdd 100644 --- a/serving/samples/helloworld-python/app.py +++ b/serving/samples/helloworld-python/app.py @@ -6,8 +6,8 @@ @app.route('/') def hello_world(): - target = os.environ.get('TARGET', 'NOT SPECIFIED') - return 'Hello World: {}!\n'.format(target) + target = os.environ.get('TARGET', 'World') + return 'Hello {}!\n'.format(target) if __name__ == "__main__": app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080))) diff --git a/serving/samples/helloworld-ruby/README.md b/serving/samples/helloworld-ruby/README.md index 3be44a7f283..c79601fa052 100644 --- a/serving/samples/helloworld-ruby/README.md +++ b/serving/samples/helloworld-ruby/README.md @@ -33,8 +33,8 @@ The following instructions recreate the source files from this folder. set :bind, '0.0.0.0' get '/' do - target = ENV['TARGET'] || 'NOT SPECIFIED' - "Hello World: #{target}!\n" + target = ENV['TARGET'] || 'World' + "Hello #{target}!\n" end ``` diff --git a/serving/samples/helloworld-ruby/app.rb b/serving/samples/helloworld-ruby/app.rb index 4b0315e0eb4..f65ed7295a4 100644 --- a/serving/samples/helloworld-ruby/app.rb +++ b/serving/samples/helloworld-ruby/app.rb @@ -3,6 +3,6 @@ set :bind, '0.0.0.0' get '/' do - target = ENV['TARGET'] || 'NOT SPECIFIED' - "Hello World: #{target}!\n" + target = ENV['TARGET'] || 'World' + "Hello #{target}!\n" end diff --git a/serving/samples/helloworld-rust/README.md b/serving/samples/helloworld-rust/README.md index 2fb9e1238d0..bab1acce52d 100644 --- a/serving/samples/helloworld-rust/README.md +++ b/serving/samples/helloworld-rust/README.md @@ -53,10 +53,10 @@ following instructions recreate the source files from this folder. let new_service = || { service_fn_ok(|_| { - let mut hello = "Hello world: ".to_string(); + let mut hello = "Hello ".to_string(); match env::var("TARGET") { Ok(target) => {hello.push_str(&target);}, - Err(_e) => {hello.push_str("NOT SPECIFIED")}, + Err(_e) => {hello.push_str("World")}, }; Response::new(Body::from(hello)) diff --git a/serving/samples/helloworld-rust/src/main.rs b/serving/samples/helloworld-rust/src/main.rs index e9564456781..3afe1ef0da9 100644 --- a/serving/samples/helloworld-rust/src/main.rs +++ b/serving/samples/helloworld-rust/src/main.rs @@ -15,10 +15,10 @@ fn main() { let new_service = || { service_fn_ok(|_| { - let mut hello = "Hello world: ".to_string(); + let mut hello = "Hello ".to_string(); match env::var("TARGET") { Ok(target) => {hello.push_str(&target);}, - Err(_e) => {hello.push_str("NOT SPECIFIED")}, + Err(_e) => {hello.push_str("World")}, }; Response::new(Body::from(hello))