From 941ac18a703241b105b2cbcd9f5aa4bab18c58be Mon Sep 17 00:00:00 2001 From: Doug Hatcher Date: Fri, 9 Aug 2024 17:45:37 +0000 Subject: [PATCH] npm start:cloud and associated documentation --- README.md | 25 +++++++++++++++++++++++-- package.json | 3 ++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e4d71d6..934dde4 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,31 @@ This repository demonstrates the minimal configuration to build an Adobe Commerce Cloud instance that's suitable for hosting general-purpose web applications, such as Node.js based PWAs. -## General Structure +## Hello World Express Server +`server.js` and `package.json` define a simple hello world express server that can be replaced with your application code. -## Single vs Multi-App Configuration +This is a typical express server that will listen on port `3000`. +```bash +npm run start +``` +Adobe Commerce Cloud is configured to listen to port `8888` by default, please make sure you have some capability to change the default port behavior. In our example, we use the environment variable `PORT` to override the default value, i.e. +```bash +npm run start:cloud +``` +In this approach, we're _adding_ a npm script which triggers the PORT. This can also be accomplished through setting a Project Variable within Adobe Commerce Cloud, or potentially in the build pipeline itself. + +## License + +The MIT License is a permissive open-source license that allows for the free use, modification, and distribution of software. It grants permission to anyone, including Adobe and other users of Adobe Commerce Cloud, to freely reuse and host applications on the platform. This license ensures that there are minimal restrictions on the usage of the code, promoting collaboration and innovation. To learn more about the MIT License, you can visit [here](https://opensource.org/licenses/MIT). + +## References + +* Useful Platform.sh Documentation + * [Using Git Submodules](https://docs.platform.sh/development/submodules.html) + * [Defining Routes](https://docs.platform.sh/define-routes.html) + * [Managing Multi-site Configurations](https://platform.sh/blog/multisite-on-platform.sh-the-how-and-why/) + * [Unified App Approach](https://platform.sh/blog/one-source-many-apps/) \ No newline at end of file diff --git a/package.json b/package.json index 1491e8f..947516c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "server.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" + "start": "node server.js", + "start:cloud": "PORT=8888 node server.js # We add this to start the server on port 8888" }, "author": "Doug Hatcher", "license": "MIT",