Hi,
I am new to serverless and am trying to use the serverless-offline plugin but I cannot seem to get it to load my routes.
Here is my serverless.yml
file:
service: cwc-sls
plugins:
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
functions:
hello:
handler: handler.hello
events:
- http:
path: /hello
method: get
It’s basically the initial project with serverless-offline added to it. Here is the handler code:
'use strict';
module.exports.hello = async event => {
return {
statusCode: 200,
body: JSON.stringify(
{
message: 'Go Serverless v1.0! Your function executed successfully!',
input: event,
},
null,
2
),
};
// Use this code if you don't use the http event with the LAMBDA-PROXY integration
// return { message: 'Go Serverless v1.0! Your function executed successfully!', event };
};
Again, the basic code.
I run sls offline start
and it fires up, though I do notice that serverless-offline defaults to :3002 and not :3000 and also ignored flags like httpPort 8080
. When I make a get request to http://localhost:3002/hello
, I get a 404 error.
Has anybody experienced this before or has advice as to how to solve this?
Thanks