- Data Models
- User
- email & password Authentication
- email verification
- password security
- Image
- Marker (Comment Thread)
- Comment
- User
- APIs
- User
- Me (current signed in user)
- Image
- Marker
- Comment
- Dockerize
- API call triggers server broadcast events to all connected clients
- Project Repo Scaffolding using some boilerplate I used before
- Development Environment
- Docker Desktop WSL
- Docker Compose with Compose V2 enabled
- MongoDB
- Set MongoDB credentials in secret/.env, create this file if it doesn't exist
- MONGO_INITDB_ROOT_USERNAME=
- MONGO_INITDB_ROOT_PASSWORD=
npm run docker-up
will spin up the MongoDB
- Data Models
- Mongoose ODM
- typegoose, never used before, evaluate if the code could be cleaner
- Unit tests using Mocha and Chai
- User
- Basic email address format validation
- Store password using scrypt
- API
- Koa.js
- Manual test using VSCode extension REST Client with test/api.http (instead of Postman)
- API Tests using node-fetch
- User
addUser
for Registration
- Me
getMe
for session validationputMe
for sign indelMe
for sign out
- Image
listImage
for listing all imagesaddImage
for adding an image metadatagetImage
for getting an image metadataupdateImage
for updating an image metadata (move image position)putImage
for uploading an image than redirect to the image URL
- Marker
listMarker
for listing all markersaddMarker
for adding a markergetMarker
for getting a markerupdateMarker
for updating a marker (move marker position)delMarker
for deleting a marker (resolve thread)- Comment
listComment
for listing comments of a marker (in a thread)addComment
for adding a comment to a marker (to a thread)delComment
for deleting a comment from a marker (from a thread)
- Dockerfile
- Realtime
- Socket.io
- Server events
saved
emitted when added or updated, event data contains one of these fields:- image
- marker
- comment (client emitting
subscribeMarker
is required to receive)
removed
emitted when deleted, event data contains one of these fields:- imageId
- markerId
- commentId (client emitting
subscribeMarker
is required to receive)
- Client events
subscribeMarker
for subscribing to events of comments under a marker (open the comment dialog)unsubscribeMarker
for unsubscribing from events of comments under a marker (close the comment dialog or marker removed)