Skip to content

Commit 8c07b81

Browse files
committed
Replace use of appPrefix w/ routePrefix
Upgraded type definitions
1 parent 762b589 commit 8c07b81

9 files changed

Lines changed: 17 additions & 30 deletions

File tree

‎package-lock.json‎

Lines changed: 4 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"template-file": "^6.0.1"
3636
},
3737
"devDependencies": {
38-
"@lambda-lambda-lambda/types": "^0.0.2",
38+
"@lambda-lambda-lambda/types": "^0.0.3",
3939
"@types/node": "^20.12.7",
4040
"@types/node-fetch": "^2.6.11",
4141
"@typescript-eslint/eslint-plugin": "^6.21.0",

‎src/generator.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export async function createFiles(appConfig: AppConfig, outPath: string): Promis
3333
pkgName: paramCase(appConfig.name),
3434
sdkPackage: (appConfig.sdkVersion === '2') ? 'aws-sdk-mock' : 'aws-sdk-client-mock',
3535
cfResourceName: pascalCase(appConfig.name),
36-
routePath: ((appConfig.prefix !== '/') ? appConfig.prefix : '') + '/example',
36+
routePath: '/example',
37+
routePrefix: ((appConfig.prefix !== '/') ? appConfig.prefix : ''),
3738
nodeVersion: appConfig.runtime.replace(/[^0-9]/g, '')
3839
};
3940

‎templates/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## Running your app
1616

17-
In the VS Code _Command Palette_ choose "Open Folder in Container" which will launch your application in a Docker container allowing for realtime development and testing. Once launched, the application can be accessed using the [Swagger UI](https://swagger.io/tools/swagger-ui) at [http://localhost:3000{{appPrefix}}/](http://localhost:3000{{appPrefix}}/) or by using the [VS Code Swagger Viewer](https://marketplace.visualstudio.com/items?itemName=Arjun.swagger-viewer) (`swagger.json`)
17+
In the VS Code _Command Palette_ choose "Open Folder in Container" which will launch your application in a Docker container allowing for realtime development and testing. Once launched, the application can be accessed using the [Swagger UI](https://swagger.io/tools/swagger-ui) at [http://localhost:3000{{routePrefix}}](http://localhost:3000{{routePrefix}}) or by using the [VS Code Swagger Viewer](https://marketplace.visualstudio.com/items?itemName=Arjun.swagger-viewer) (`swagger.json`)
1818

1919
## Deploying to AWS
2020

‎templates/app-async.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ exports.handler = async (event, context, callback) => {
2323
router.use(appConfigPlugin(config));
2424
router.use(swaggerUIViewer(swaggerJson));
2525

26-
// Send root response ({{appPrefix}}/)
26+
// Send root response (prefix path).
2727
router.get('/', function(req, res) {
2828

29-
// Redirect to Swagger viewer.
30-
res.setHeader('Location', `${config.router.prefix}/?swagger-ui=html`);
29+
// Redirect to Swagger UI viewer.
30+
res.setHeader('Location', `${config.router.prefix}?swagger-ui=html`);
3131
res.status(301).send();
3232
});
3333

‎templates/app.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ exports.handler = (event, context, callback) => {
2323
router.use(appConfigPlugin(config));
2424
router.use(swaggerUIViewer(swaggerJson));
2525

26-
// Send root response ({{appPrefix}}/)
26+
// Send root response (prefix path).
2727
router.get('/', function(req, res) {
2828

29-
// Redirect to Swagger viewer.
30-
res.setHeader('Location', `${config.router.prefix}/?swagger-ui=html`);
29+
// Redirect to Swagger UI viewer.
30+
res.setHeader('Location', `${config.router.prefix}?swagger-ui=html`);
3131
res.status(301).send();
3232
});
3333

‎templates/route-async.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
/**
1111
* @openapi
1212
*
13-
* {{routePath}}:
13+
* {{routePrefix}}{{routePath}}:
1414
* get:
1515
* description: Route description.
1616
* responses:

‎templates/route.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
/**
1111
* @openapi
1212
*
13-
* {{routePath}}:
13+
* {{routePrefix}}{{routePath}}:
1414
* get:
1515
* description: Route description.
1616
* responses:

‎templates/swagger.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"paths": {
18-
"{{routePath}}": {
18+
"{{routePrefix}}{{routePath}}": {
1919
"get": {
2020
"description": "Route description.",
2121
"responses": {

0 commit comments

Comments
 (0)