Your task is to implement simple CRUD API using in-memory database underneath.
- The task must be solved using only Go,and Go related framework provided packages in go.mod
- API path
/person:- GET
/personor/person/${personId}should return all persons or person with correspondingpersonId - POST
/personis 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
objectsthat 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 (arrayofstringsor 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 accessible by frontend apps hosted on a different domain (cross-site resource sharing)