WithHelloWorldApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.
(f func(dir string))
| 35 | // staticfile_buildpack" so that your app will correctly start up with the |
| 36 | // proper buildpack. |
| 37 | func WithHelloWorldApp(f func(dir string)) { |
| 38 | dir := TempDirAbsolutePath("", "simple-app") |
| 39 | defer os.RemoveAll(dir) |
| 40 | |
| 41 | tempfile := filepath.Join(dir, "index.html") |
| 42 | err := os.WriteFile(tempfile, []byte(fmt.Sprintf("hello world %d", rand.Int())), 0666) |
| 43 | Expect(err).ToNot(HaveOccurred()) |
| 44 | |
| 45 | err = os.WriteFile(filepath.Join(dir, "Staticfile"), nil, 0666) |
| 46 | Expect(err).ToNot(HaveOccurred()) |
| 47 | |
| 48 | f(dir) |
| 49 | } |
| 50 | |
| 51 | // WithMultiEndpointApp creates a simple application to use with your CLI command |
| 52 | // (typically CF Push). It has multiple endpoints which are helpful when testing |