Rahul Ravikumar | 8202873 | 2019-04-23 18:11:25 -0700 | [diff] [blame] | 1 | # Fetch Licenses |
| 2 | |
| 3 | A service that makes license files readable using headless Chrome. |
| 4 | |
| 5 | ### Setup |
| 6 | |
| 7 | * This project uses TypeScript and Node. |
Rahul Ravikumar | 92dc5cd | 2022-02-22 10:04:42 -0800 | [diff] [blame] | 8 | * Download `fnm` and run `fnm install` to install a suitable version of Node. |
Rahul Ravikumar | e9607c5 | 2020-08-19 11:18:54 -0700 | [diff] [blame] | 9 | * Run `npm install` to setup dependencies. |
Rahul Ravikumar | 8202873 | 2019-04-23 18:11:25 -0700 | [diff] [blame] | 10 | * Use Visual Studio code to debug and test. |
| 11 | |
| 12 | ### Testing |
| 13 | |
| 14 | #### Local debugging |
| 15 | Run the web service locally using the provided package scripts. |
Rahul Ravikumar | e9607c5 | 2020-08-19 11:18:54 -0700 | [diff] [blame] | 16 | Run `npm run-script debug` and this spins up a local web server. You can use Visual Studio code to attach to this process. |
Rahul Ravikumar | 8202873 | 2019-04-23 18:11:25 -0700 | [diff] [blame] | 17 | `nodemon` and `tsc --watch` compiles and restarts your service as you are making changes to the source code automatically in `debug` mode. |
| 18 | |
| 19 | #### Example HTTP Request |
| 20 | |
| 21 | ``` |
| 22 | curl -d '{"url": "https://opensource.org/licenses/bsd-license.php"}' -H 'Content-Type: application/json' -X POST 'http://localhost:8080/convert/licenses' |
| 23 | ``` |
| 24 | |
| 25 | ### Deploy |
| 26 | |
| 27 | * Install the `gcloud` CLI. |
Rahul Ravikumar | e9607c5 | 2020-08-19 11:18:54 -0700 | [diff] [blame] | 28 | * Run `npm run-script setupGcpProject` to setup credentials. |
| 29 | * Run `npm run-script deploy` to deploy the project to App Engine. |
Rahul Ravikumar | 0cd5ae0 | 2023-03-28 17:35:20 -0700 | [diff] [blame] | 30 | |
| 31 | |
| 32 | ### Notes |
| 33 | |
| 34 | Using Puppeteer v18.2.1 only because `npm post install` scripts for Puppeteer 19.x.x have been broken for App Engine standard. |
| 35 | More context is [here](https://github.com/puppeteer/puppeteer/issues/9128). |