just do: yarn start
to start the server and see all routes.
Use the Serverless framework and our TypeScript boilerplate application to complete the 3 endpoints below.
Instructions
As part of the interview process we would like you to complete a coding challenge that demonstrates your knowledge of Node and Serverless which our codebase is built on.
When you complete the challenge you should upload your code to a Github private repo and share with: (smchalal, abrougher, fhern077 or ianwsperber. We also advise you reply to the initial email with the assignment and confirm you have shared with these users.
Additional details can be found in the handlers for each of the below endpoints in src/index.ts
Return the Popeyes menu
- Update the
menuHandler
inindex.ts
Note: For this first endpoint, we have already defined the endpoint in serverless.yml
. You only need to update the handler in src/index.ts
Define a new endpoint, GET /cart
, which returns the user cart enriched with our internal item IDs.
- Add a serverless definition in
serverless.yml
- Update the
cartHandler
inindex.ts
- Use the
plus.json
file to determine the PLU to item ID mapping.
- Use the
Define a new endpoint, GET /4pc-chicken/calories
, which returns the min & max calories for a 4 piece chicken combo
- Add a serverless definition in
serverless.yml
- Update the
calorieCounterHandler
inindex.ts
- Compute the min & max calories for the 4pc chicken combo
To complete the homework, you should only have to touch the below 2-3 files.
src/index.ts
: Entrypoint for our application. Contains all our lambda handler methods.
serverless.yml
: Serverless definition to register our Lambda functions and create HTTP endpoints. For more information see https://serverless.com/framework/docs.
(Optional) src/__tests__/index.spec.ts
: Jest test suite
We use the serverless-offline
plugin to create a local dev server from your serverless.yml
. By default this will run on http://localhost:3001.
yarn start
This command will build your assets prior to running. The server will not restart automatically for changed assets.
We include a basic jest test suite in src/__tests_/index.spec.ts
.
yarn test
Feel free to add to these tests as you see fit.
A build command is included to transpile the typescript. The transpiled JavaScript is output to dist
.
yarn build
Note: The dist
directory will get blown away before every build.