Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takumakira/note-taking-app-api-gin
https://github.com/takumakira/note-taking-app-api-gin
Last synced: about 16 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/takumakira/note-taking-app-api-gin
- Owner: TakumaKira
- Created: 2023-11-17T09:13:58.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-24T09:17:43.000Z (about 1 year ago)
- Last Synced: 2023-11-24T10:29:08.769Z (about 1 year ago)
- Language: Go
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# note-taking-app-api-gin
- [note-taking-app-api-gin](#note-taking-app-api-gin)
- [Run](#run)
- [Run tests](#run-tests)
- [The task from ChatGPT](#the-task-from-chatgpt)## Run
```bash
go run cmd/app/main.go
```## Run tests
```bash
go test ./...
```## The task from ChatGPT
This API will allow users to create, read, update, and delete notes. Here's a basic specification:
API Specification: Note-Taking Application
API Base URL: https://yourapi.com/api/v1Endpoints:
a. Create a Note
b. Get All Notes
- Method: GET
- Endpoint: /notes
- Response:
json [ { "id": "unique-note-id", "title": "string", "content": "string", "createdAt": "timestamp" } ]c. Get a Single Note
- Method: GET
- Endpoint: /notes/{noteId}
- Response:
json { "id": "unique-note-id", "title": "string", "content": "string", "createdAt": "timestamp" }d. Update a Note
- Method: PUT
- Endpoint: /notes/{noteId}
- Body:
json { "title": "string", "content": "string" } - Response:
json { "id": "unique-note-id", "title": "string", "content": "string", "updatedAt": "timestamp" }e. Delete a Note
- Method: DELETE
- Endpoint: /notes/{noteId}
- Response:
json { "message": "Note deleted successfully." }Authentication:
For simplicity, we can omit authentication. However, in a real-world scenario, you would likely add an authentication layer to protect the data.
Error Handling:Make sure to handle common HTTP errors (e.g., 404 Not Found, 500 Internal Server Error) with appropriate error messages.
This API is quite basic and meant for practice. In a real-world scenario, you would need to consider more complex elements like authentication, more robust error handling, data validation, and possibly rate limiting.