Sparkpost Technical Exercise

This API server listens for HTTP REST requests.

The server will accept the JSON payload and store it locally in the server.

Getting Started

  1. git clone https://github.com/EdkChow/sparkpost-technical.git

  2. cd sparkpost-technical

  3. Start the server:

    • npm install
    • node server/server.js

    OR using Docker example below:

    • docker build --tag sparkpost-technical:1.0 .
    • docker run --publish 8000:8000 sparkpost-technical:1.0
  4. Use an API client to test the server endpoints, such as Postman

The Payload Object

Attributes

  • name [string]
    • name of the user
  • age [number]
    • age of the user

{ "name": "x", "age": 4 }

Endpoints

  • POST /sparkpost
    • Request Body: provide [payload object]
    • Response: [payload object] POST
  • PUT /sparkpost/:id
    • Parameters: id name must exist in local server and must be the same name as the payload object
    • Request Body: provide [payload object]
    • Response: updated [payload object] PUT
  • GET /sparkpost/:id
    • Parameters: id name must exist in local server
    • Response: [payload object] GET