A simple REST API service that allows the user to perform CRUD operations on a messages database collection.
In order to test the application locally, you will need to have the following minimum requirements met.
- Node.JS (8.9.4)
- NPM (5.5.1)
- MongoDB (3.4.9)
- Redis (3.2.100)
The stack is based primarily on NodeJS for the backend, and React for the frontend. I also identified that in order to push updates to the client side dynamically, I would need to include Websockets, via socket.io, in order to push down new messages to all connected users. I also wanted to find a way to track unique users, and the initial thought was to not go down the path of username/password, login email, etc. Instead I decided that through the use of sessions we could identifier new users, allows themself to create a "user account" for that particular session. I've done session management through using Redis, so it seemed like the simplest approach.
In terms of tracking the messages, I decided that we were going to need two collection to start with.
By tracking the User in the messages collection, we allow ourselves to query messages per user, and identify (in the future) who is allowed to delete which message.
With regards to updating active users with message updates, we can acccomplish this by using the following examples.
GET /v1/message?id
Parameters
+ id: optional. references the mongodb _id of the document.
Returns
200: [{Message}}]
400: {msg: String}
500: {msg: String}
POST /v1/message
BODY
+ text: String A required field
RETURNS
201: {Message}
400: {msg: String}
500: {msg: String}
PUT /v1/message
Parameters
+ id: required. references the mongodb _id of the document.
Body
+ text: String A required field
Returns
200: {Message}
400: {msg: String}
500: {msg: String}
DELETE /v1/message?id
Parameters
+ id: required. references the mongodb _id of the document.
Returns
200: {Message}
400: {msg: String}
500: {msg: String}
If you have any issues building, deploying or accessing the application, please reach out and let me konw. At this time the application will be running in developement mode.
- Download the repository
git clone https://github.com/mattfelske/service-messaging.git
- Install NPM dependencies
npm install
- Build the application
npm run build
- Launch the application
npm start
The application can be reached on http://localhost:8001, or online at http://test-jeragroup.ca:8001.
Please note that Chrome is notorious for redirecting to https, but the application still works in Incognito mode.
- Allows users to submit/post messages
- Lists received messages (Locally)
- Retreives a specific message on demand, and dtermines if it is a palindrome
- Allows users to delete specific messages (Currently allows any user to delete any message
- Shows the list of messages posted by the users
- Allows to post new messages
- Allows to select a given message to see extra details
- Add user support to messages (need to resolve sessionID cookie generation)
- Add WebSocket support so that multiple users connected at the same time can updated the DB and the UI simultaneously
- Fix express session implementation to allow for user creation (requires modal for first time user/session)
- Mocha/Chair Test case suite for testing endpoints and functions. (Specifically palindrome utility function)
- Containerize the application using Docker
- Update configuration management to be dynamic based on environment.
- Improve loggin implementation
- Front end implementation of user functionality



