Comments (10)
In the spirit of keeping dependencies and external tools to a minimum, I solved this by splitting the route management into a separate module (api.js
) so that it could be accessed either by lambda.js
or local.js
. The latter contains a small web server that fakes the essentials for lambda-api to function properly.
I've put my sample solution in a gist here: https://gist.github.com/Sleavely/f87448d2c1c13d467f3ea8fc7e864955
from lambda-api.
I can confirm that lambda-api works perfectly fine with serverless-offline.
Note that serverless-offline just simulates AWS API Gateway, so it is framework agnostic.
from lambda-api.
Thanks, @jeremydaly. I was thinking of trying to wrap it in an express app for this purpose but opted to just go with serverless-offline
, since we're using serverless
for the rest of our build process as well.
If you do come up with an idea and would like some help putting it together, I'm happy to give it a shot!
from lambda-api.
@abmohan, this is a great idea. This might be possible with the serverless-offline
plugin, but it would be nice to have a solution that wasn't tethered to a single framework. I'll do some investigating, but any ideas you have would be appreciated!
from lambda-api.
I can confirm that lambda-api works fine with AWS SAM CLI https://github.com/awslabs/aws-sam-cli
from lambda-api.
In the spirit of keeping dependencies and external tools to a minimum, I solved this by splitting the route management into a separate module (
api.js
) so that it could be accessed either bylambda.js
orlocal.js
. The latter contains a small web server that fakes the essentials for lambda-api to function properly.I've put my sample solution in a gist here: https://gist.github.com/Sleavely/f87448d2c1c13d467f3ea8fc7e864955
In my local env, throw a exception and not work :( You can help me? Thanks
from lambda-api.
In the spirit of keeping dependencies and external tools to a minimum, I solved this by splitting the route management into a separate module (
api.js
) so that it could be accessed either bylambda.js
orlocal.js
. The latter contains a small web server that fakes the essentials for lambda-api to function properly.
I've put my sample solution in a gist here: https://gist.github.com/Sleavely/f87448d2c1c13d467f3ea8fc7e864955In my local env, throw a exception and not work :( You can help me? Thanks
It looks like there is no body
in the response. Could it be because you don't have a route defined for the path you are accessing? If you copy-pasted my Gist as-is; does /status
work? Are you able to share the code that's breaking?
from lambda-api.
In the spirit of keeping dependencies and external tools to a minimum, I solved this by splitting the route management into a separate module (
api.js
) so that it could be accessed either bylambda.js
orlocal.js
. The latter contains a small web server that fakes the essentials for lambda-api to function properly.
I've put my sample solution in a gist here: https://gist.github.com/Sleavely/f87448d2c1c13d467f3ea8fc7e864955In my local env, throw a exception and not work :( You can help me? Thanks
It looks like there is no
body
in the response. Could it be because you don't have a route defined for the path you are accessing? If you copy-pasted my Gist as-is; does/status
work? Are you able to share the code that's breaking?
Yes, i upload the test code to my github: https://github.com/jlopezcrd/lambda-api-test
from lambda-api.
In the spirit of keeping dependencies and external tools to a minimum, I solved this by splitting the route management into a separate module (
api.js
) so that it could be accessed either bylambda.js
orlocal.js
. The latter contains a small web server that fakes the essentials for lambda-api to function properly.I've put my sample solution in a gist here: https://gist.github.com/Sleavely/f87448d2c1c13d467f3ea8fc7e864955
I've modified the local file and it works. You can review it:
https://github.com/jlopezcrd/lambda-api-test/compare/master...fixlocal?expand=1
Regards.
from lambda-api.
I've modified the local file and it works. You can review it:
https://github.com/jlopezcrd/lambda-api-test/compare/master...fixlocal?expand=1Regards.
Interesting. I'm not sure why that approach works but I'm glad you got it running :)
from lambda-api.
Related Issues (20)
- Cannot find module '@aws-sdk/client-s3' HOT 3
- Compatible versions of lambda-api 1.x and aws-sdk 3.x HOT 4
- peerDependencies appear to make packaged Lambda much bigger HOT 3
- [Feature request] Typescript - Support generic request / response types HOT 2
- CORS pre-flight OPTIONS not working because of lowercase casting HOT 2
- Minimum reproducible example for "Method not allowed" error
- Response is not as expected, the body has a body property but is not the actual body HOT 1
- Typescript documentation is out of date - createApi() no longer parses HOT 1
- Should own types for typescript support HOT 1
- Sending JSON with res.send vs sending images with res.sendFile HOT 4
- Is it possible to disable versioning? HOT 4
- as of v1.0.1, node_modules size increased significantly HOT 2
- Logger Output HOT 1
- Logger is not handling missing context HOT 3
- API returns invalid PDF HOT 6
- Weird issue with jest and calling Lambda handler HOT 1
- Open API Schema HOT 1
- use Lambda-api as a web framework for ECS HOT 3
- [Bug]: Library does not parse cookie values containing '=' correctly HOT 1
- [Bug] Library expects all cookies to be URL encoded
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lambda-api.