A simple REST API built using No third-party packages/dependencies
-
GET /surfspots
returns list of surfspots as JSON -
GET /surfspots/{id}
returns details of specific surfspot as JSON -
GET /admin
requires basic auth -
GET /surfspots/random
redirects (Status 302) to a random surfspot -
POST /surfspots
accepts a new surfspot to be added -
POST /surfspots
returns status 415 if content is notapplication/json
-
DELETE /surfspots/{id}
returns an empty object {} -
PUT /surfspots/{id}
returns the updated surfspot as JSON -
Each endpoint should have a test
A surfspot object should look like this:
{
"id": "someid",
"name": "name of the surfspot",
"founder": "the name of the person who found the sufspotspot",
"beach": "name of the beach the surfspot is located at",
"difficulty": 5,
}
There is no persistence, just temporary in-memory storage.