I have a serverless project that I just newly initialized:
severless.yml
:
service: lambda
provider:
name: aws
runtime: nodejs8.10
region: us-east-1
functions:
hello:
handler: handler.hello
events:
- http:
path: /hello
method: GET
plugins:
- serverless-offline
And I run it with sls offline --port 8080
:
Serverless: Starting Offline: dev/us-east-1
Serverless: Routes for hello:
Serverless: GET /hello
Serverless: Offline listening on http://localhost:8080
and in my handler.ts
module.exports.hello = async (event, context) => {
console.log('HIIII')
return {
statusCode: 200,
body: JSON.stringify({
message: 'Go Serverless v1.0! Your function executed successfully!',
input: event,
}),
};
};
I hit up this endpoint on Postman locally and it doesn't seem to work. All I get is some HTML saying Cannot GET /hello
. I've tried making GET requests to http://localhost:8080/dev/hello
or http://localhost:8080/hello
and I still get the same errors. Am I doing something wrong here?