コード例 #1
0
        public Response Hi(Request request)
        {
            var body = new ExampleResponseBody
            {
                Message   = $"Go Serverless! Env var something is set to: {System.Environment.GetEnvironmentVariable("SOMETHING")}",
                SomeValue = 2
            };

            return(new Response
            {
                StatusCode = 200,
                Headers = new Dictionary <string, string>(),
                Body = JsonConvert.SerializeObject(body),
            });
        }
コード例 #2
0
        public Response Hello(Request request)
        {
            var name = "Jane Doe";

            if (request.QueryStringParameters != null && request.QueryStringParameters.ContainsKey("name"))
            {
                name = request.QueryStringParameters["name"];
            }

            var body = new ExampleResponseBody
            {
                Message   = $"Go Serverless! Hello {name} from HTTP!",
                SomeValue = 1
            };

            return(new Response
            {
                StatusCode = 200,
                Headers = new Dictionary <string, string>(),
                Body = JsonConvert.SerializeObject(body),
            });
        }