{"id":20560714,"url":"https://github.com/haider8/tmessage-api","last_synced_at":"2025-07-13T00:36:06.609Z","repository":{"id":103068369,"uuid":"212143642","full_name":"Haider8/tmessage-api","owner":"Haider8","description":"Restful API for tmessage - a CLI based messaging tool (https://github.com/Haider8/tmessage)","archived":false,"fork":false,"pushed_at":"2019-10-12T20:50:32.000Z","size":4,"stargazers_count":1,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-02T02:52:10.493Z","etag":null,"topics":["cli-app","expressjs","javascript","messaging-tool","mongodb","mqtt","nodejs","tmessage"],"latest_commit_sha":null,"homepage":"https://peaceful-waters-15584.herokuapp.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Haider8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-01T16:21:51.000Z","updated_at":"2023-08-20T10:01:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2b027e3-f0cc-473c-9369-30de44ab6a27","html_url":"https://github.com/Haider8/tmessage-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haider8%2Ftmessage-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haider8%2Ftmessage-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haider8%2Ftmessage-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haider8%2Ftmessage-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Haider8","download_url":"https://codeload.github.com/Haider8/tmessage-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234255786,"owners_count":18803721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-app","expressjs","javascript","messaging-tool","mongodb","mqtt","nodejs","tmessage"],"created_at":"2024-11-16T03:55:30.666Z","updated_at":"2025-01-16T18:59:15.651Z","avatar_url":"https://github.com/Haider8.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tmessage API\n\nThis is a RESTful API handling authentication logic for [tmessage](https://github.com/Haider8/tmessage) - a lightweight and low bandwidth chatting tool.\n\n## Installation and Hosting\n\nFirst, to host this API locally, you would need...\n* Node.js and NPM (Noed Package Manager) installed\n* A text editor\n* A command-line terminal\n\nSecond, you would need to host a MongoDB database. You can either do it locally or on a service such as [mongoDB Atlas](https://www.mongodb.com/cloud/atlas). When the database is up and running, you need a connection string to set up connection between the API and the database (follow [this instruction](https://www.youtube.com/watch?v=Ej05tq1220A) if you use [mongoDB Atlas](https://www.mongodb.com/cloud/atlas)).\n\nStep-by-step to set up the API:\n1. Open the terminal where you want to store the project\n1. Clone the project:\n    ```shell\n    git clone https://github.com/Haider8/tmessage-api.git\n    ```\n1. Navigate into the project:\n    ```shell\n    cd tmessage-api\n    ```\n1. Install all dependencies/packages of the project:\n    ```shell\n    npm i\n    ```\n1. Create a file named `.env` in the current directory:\n    ```shell\n    touch .env\n    ```\n1. Open the `.env` file with a text editor and enter the following content:\n    ```\n    MONGODB_CONNECTION_STRING=[Your MongoDB connection string]\n    ```\n1. Subtitute `[Your MongoDB connection string]` with your MongoDB connection string you got earlier.\n1. Save and close the file.\n1. Host the API:\n    ```shell\n    node server.js\n    ```\n1. Use an Http Client (e.g.: Postman) to test the API.\n\n## API References\n\n### POST: /api/user/register\n\nMake a reuqest to this route to register a User Account, expected body data shape:\n* user_name: A string - name used for login (used with the --user parameter)\n* displayed_name: A string - name used to display when communicate with others\n* password: A string\n* password_confirm: A string matches `password`\n\nThe reponse of returned data includes 2 fields:\n* success: `true` if the registration process is successfull, `false` otherwise\n* token: A JWT token to be decoded if `success` is `true`, `undefined` otherwise\n* message: A message\n\n### POST: /api/user/login\n\nMake a reuqest to this route to login, expected body data shape:\n* user_name: A string\n* password: A string\n\nThe reponse of returned data includes 2 fields:\n* success: `true` if the login process is successfull, `false` otherwise\n* token: A JWT token to be decoded if `success` is `true`, `undefined` otherwise\n* message: A message\n\n### GET: /api/user/checkExist/:user_name\n\nMake a request to this route to check if a `user_name` is occupied or not.\nThe reponse of returned data includes 3 fields:\n* success: `true` if the checking process is successfull, `false` otherwise\n* exist: `true` if the `user_name` is occupied, `false` if the `user_name` is not taken, `undefined` if `success` is `false`\n* message: A message\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaider8%2Ftmessage-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaider8%2Ftmessage-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaider8%2Ftmessage-api/lists"}