Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ten-lac/feature/custom-server-file-location
Custom Server File Location
- Loading branch information
Showing
22 changed files
with
250 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const { Hapi } = require('../../helpers'); | ||
const Lalalambda = require('../../..'); | ||
|
||
exports.deployment = async () => { | ||
|
||
const server = Hapi.server(); | ||
|
||
await server.register(Lalalambda); | ||
|
||
server.lambda({ | ||
id: 'invoke-lambda', | ||
handler: () => ({ success: 'invoked' }) | ||
}); | ||
|
||
return server; | ||
}; |
3 changes: 3 additions & 0 deletions
3
test/closet/invoke-custom-server-path-escaped/.serverless_plugins/lalalambda.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../../../..'); |
12 changes: 12 additions & 0 deletions
12
test/closet/invoke-custom-server-path-escaped/serverless.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
service: my-service | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
|
||
custom: | ||
lalalambda: | ||
serverPath: "'.js" | ||
|
||
plugins: | ||
- lalalambda |
3 changes: 3 additions & 0 deletions
3
test/closet/invoke-custom-server-path/.serverless_plugins/lalalambda.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../../../..'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
service: my-service | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
|
||
custom: | ||
lalalambda: | ||
serverPath: 'src/server.js' | ||
|
||
plugins: | ||
- lalalambda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const { Hapi } = require('../../../helpers'); | ||
const Lalalambda = require('../../../..'); | ||
|
||
exports.deployment = async () => { | ||
|
||
const server = Hapi.server(); | ||
|
||
await server.register(Lalalambda); | ||
|
||
server.lambda({ | ||
id: 'invoke-lambda', | ||
handler: () => ({ success: 'invoked' }) | ||
}); | ||
|
||
return server; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// This exists to ensure that when serverPath isn't specified, this file | ||
// doesn't get picked-up as the default server export rather than server.js |
3 changes: 3 additions & 0 deletions
3
test/closet/missing-server-file/.serverless_plugins/lalalambda.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../../../..'); |
5 changes: 5 additions & 0 deletions
5
test/closet/missing-server-file/.serverless_plugins/serverless-offline-mock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
const Helpers = require('../../../helpers'); | ||
|
||
module.exports = Helpers.OfflineMock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
service: my-service | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
|
||
plugins: | ||
- lalalambda | ||
- serverless-offline-mock |
3 changes: 3 additions & 0 deletions
3
test/closet/server-file-location-with-file-extension/.serverless_plugins/lalalambda.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../../../..'); |
5 changes: 5 additions & 0 deletions
5
...t/server-file-location-with-file-extension/.serverless_plugins/serverless-offline-mock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
const Helpers = require('../../../helpers'); | ||
|
||
module.exports = Helpers.OfflineMock; |
13 changes: 13 additions & 0 deletions
13
test/closet/server-file-location-with-file-extension/serverless.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
service: my-service | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
|
||
custom: | ||
lalalambda: | ||
serverPath: 'src/server.js' | ||
|
||
plugins: | ||
- lalalambda | ||
- serverless-offline-mock |
13 changes: 13 additions & 0 deletions
13
test/closet/server-file-location-with-file-extension/src/server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const { Hapi } = require('../../../helpers'); | ||
const Lalalambda = require('../../../../lib'); | ||
|
||
exports.deployment = async () => { | ||
|
||
const server = Hapi.server(); | ||
|
||
await server.register(Lalalambda); | ||
|
||
return server; | ||
}; |
3 changes: 3 additions & 0 deletions
3
test/closet/server-file-location-without-file-extension/.serverless_plugins/lalalambda.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../../../..'); |
5 changes: 5 additions & 0 deletions
5
...erver-file-location-without-file-extension/.serverless_plugins/serverless-offline-mock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
const Helpers = require('../../../helpers'); | ||
|
||
module.exports = Helpers.OfflineMock; |
13 changes: 13 additions & 0 deletions
13
test/closet/server-file-location-without-file-extension/serverless.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
service: my-service | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
|
||
custom: | ||
lalalambda: | ||
serverPath: 'src/server' | ||
|
||
plugins: | ||
- lalalambda | ||
- serverless-offline-mock |
13 changes: 13 additions & 0 deletions
13
test/closet/server-file-location-without-file-extension/src/server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const { Hapi } = require('../../../helpers'); | ||
const Lalalambda = require('../../../../lib'); | ||
|
||
exports.deployment = async () => { | ||
|
||
const server = Hapi.server(); | ||
|
||
await server.register(Lalalambda); | ||
|
||
return server; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters