From b05d93572b63a80366f6d032d2cf6292e12eea6c Mon Sep 17 00:00:00 2001 From: alanb-sony <62992435+alanb-sony@users.noreply.github.com> Date: Thu, 15 Oct 2020 12:09:51 +0100 Subject: [PATCH 1/2] Update Readme.md fix typo and change .js to .ts --- app/templates/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/README.md b/app/templates/README.md index b54fd5e..e8cc060 100644 --- a/app/templates/README.md +++ b/app/templates/README.md @@ -22,7 +22,7 @@ npm run test ## How do I modify the example API and make it my own? There are two key files: -1. `server/routes.js` - This references the implementation of all of your routes. Add as many routes as you like and point each route your express handler functions. +1. `server/routes.ts` - This references the implementation of all of your routes. Add as many routes as you like and point each route your express handler functions. 2. `server/common/api.yaml` - This file contains your [OpenAPI spec](https://swagger.io/specification/). Describe your API here. It's recommended that you to declare any and all validation logic in this YAML. `express-no-stress-typescript` uses [express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) to automatically handle all API validation based on what you've defined in the spec. ## Install Dependencies @@ -71,7 +71,7 @@ npm run test:debug ``` ## Try It -* Open you're browser to [http://localhost:3000](http://localhost:3000) +* Open your browser to [http://localhost:3000](http://localhost:3000) * Invoke the `/examples` endpoint ```shell curl http://localhost:3000<%= apiRoot %>/examples From 746b89b0d07b8b24354e52e95bcc40d1ff61f7bb Mon Sep 17 00:00:00 2001 From: alanb-sony <62992435+alanb-sony@users.noreply.github.com> Date: Thu, 15 Oct 2020 12:16:42 +0100 Subject: [PATCH 2/2] Update README.md change .js to .ts --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 609b000..5fc085d 100644 --- a/README.md +++ b/README.md @@ -261,13 +261,13 @@ paths: **Q**: How do I modify the example API and make it my own? **A**: There are two key files that enable you to customize and describe your API: -1. `server/routes.js` - This references the implementation of all of your routes. Add as many routes as you like and point each route your express handler functions. +1. `server/routes.ts` - This references the implementation of all of your routes. Add as many routes as you like and point each route your express handler functions. 2. `server/common/api.yaml` - This file contains your [OpenAPI spec](https://swagger.io/specification/). Describe your API here. It's recommended that you to declare any and all validation logic in this YAML. `express-no-stress-typescript` uses [express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) to automatically handle all API validation based on what you've defined in the spec. **Q**: I previously generated an app, but I want to change the API root. How do I do this? **A**: You need to make to small changes - 1. Modify `server/routes.js` + 1. Modify `server/routes.ts` ```javascript // Change your original path e.g. /api/v1/examples, to: app.use('/api/v2/examples', examplesRouter);