Your task is to implement simple CRUD API using in-memory database underneath.
- The task must be solved using only Go, or Go related framework
- API path
/person
:- GET
/person
or/person/${personId}
should return all persons or person with correspondingpersonId
- POST
/person
is used to create record about new person and store it in database - PUT
/person/${personId}
is used to update record about existing person - DELETE
/person/${personId}
is used to delete record about existing person from database
- GET
- Persons are stored as
objects
that have following properties:id
— unique identifier (string
,uuid
) generated on server sidename
— person's name (string
, required)age
— person's age (number
, required)hobbies
— person's hobbies (array
ofstrings
or emptyarray
, required)
- Requests to non-existing endpoints (e.g.
/some-non/existing/resource
) should be handled. - Internal server errors should be handled and processed correctly.
- Make sure the api is accesible by frontend apps hosted on a different domain (cross-site resource sharing)