A short, personal, implementation of the the RotP challenge. This example actually sets up an AWS Lambda that exposes an endpoint to send the test-cases over that you want solved. It was a fun little experiment taking just the base of the project a little further and testing the waters with Go Lambda's and the Serverless framework.
An example client can be found here.
Name | Info |
---|---|
Go 1.9.4 | Go Website |
AWS Lambda | AWS Lambda Go |
Serverless FW | Serverless Framework Website |
React | React Website |
PRE) Make sure you have the serverless framework installed and your AWS CLI configured to your own account. You'll also need Go and Dep setup in order to build the binaries.
$ cd rotp-go
- Create your lambda:
$ make && serverless deploy
- Test your lambda:
$ serverless invoke -f rotp-go -p data.json
The client is just a simple create-react-app to make calling the lambda easier and more custom.
$ cd rotp-ui
- Install dependencies:
$ npm install
- Configure your endpoint:
$ vim src/shared/api/base.ts
- Run locally:
$ npm start
I've setup a sample request for the serverless framework that can be invoked to sends over the following (Base64 encoded) to the endpoint:
5
-
-+
+-
+++
--+-
Which should respond with the results of the test like so:
{
"statusCode": 200,
"headers": null,
"body": {
"data" : [
{
"result" : 1,
"testNumber" : 1,
"testPattern" : "-"
},
{
"result" : 1,
"testNumber" : 2,
"testPattern" : "-+"
},
{
"result" : 2,
"testNumber" : 3,
"testPattern" : "+-"
},
{
"result" : 0,
"testNumber" : 4,
"testPattern" : "+++"
},
{
"result" : 3,
"testNumber" : 5,
"testPattern" : "--+-"
}
]
}
}