{"id":19901240,"url":"https://github.com/vbrazhnik/chat-room-api","last_synced_at":"2026-04-04T21:32:12.464Z","repository":{"id":220985370,"uuid":"169925264","full_name":"VBrazhnik/Chat-Room-API","owner":"VBrazhnik","description":"Chat Room RESTful API [MongoDB + Express.js + Node.js]","archived":false,"fork":false,"pushed_at":"2019-02-13T12:11:11.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-03T14:35:11.465Z","etag":null,"topics":["chat-room","express-js","mongodb","mongoose","node-js","restful-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"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/VBrazhnik.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}},"created_at":"2019-02-09T23:34:49.000Z","updated_at":"2020-03-16T07:56:17.000Z","dependencies_parsed_at":"2024-02-12T01:30:18.316Z","dependency_job_id":null,"html_url":"https://github.com/VBrazhnik/Chat-Room-API","commit_stats":null,"previous_names":["vbrazhnik/chat-room-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VBrazhnik/Chat-Room-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VBrazhnik%2FChat-Room-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VBrazhnik%2FChat-Room-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VBrazhnik%2FChat-Room-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VBrazhnik%2FChat-Room-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VBrazhnik","download_url":"https://codeload.github.com/VBrazhnik/Chat-Room-API/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VBrazhnik%2FChat-Room-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31415110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["chat-room","express-js","mongodb","mongoose","node-js","restful-api"],"created_at":"2024-11-12T20:14:27.224Z","updated_at":"2026-04-04T21:32:12.436Z","avatar_url":"https://github.com/VBrazhnik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chat Room API\n\nChat Room RESTful API was developed using MongoDB, Express.js and Node.js.\n\n## Task\n\n### Description\n\nUnauthenticated users can post messages in chat so others can read them.\nMessages need to be saved to the database.\n\n### Basic requirements\n\n* Koa/Express, MongoDB\n* The message must contain author (unauthenticated user) email and text, create date and update date\n* Email validation (regex to check if that is a real email)\n* Message validation (regex to check if a message is not empty string, and length \u003c 100)\n\n### API methods\n\n* `GET` method for getting all messages with pagination by 10 messages per request (e.g. `/api/messages/list/0` will return first 10 messages)\n\n* `GET` method for getting single message by unique identifier (e.g. `/api/messages/single/59f7303c2f60e5d7e6167dd1`)\n\n* `POST` method for creating a new message (body accepts email and text)\n\n## Documentation\n\n### Installation\n\nClone repository and install node modules:\n\n```\n$ git clone \u003crepository url\u003e \u003cfolder name\u003e\n$ cd \u003cfolder name\u003e\n$ npm i\n```\n\n### Configuration \u0026 Execution\n\nYou can use environment variables to specify server port and MongoDB database URI:\n\n```\n$ PORT=\u003cport\u003e DB_URI=\u003cdatabase URI\u003e npm start\n```\n\nIf these environment variables were not set, default values will be used. Default values are specified in `config.js` file.\n\n### Message\n\n#### Structure\n\nField|Data Type|Required|Default|Restrictions|Note\n:-----|:-----|:-----|:-----|:-----|:-----\n`email`|String|Required|—|Value must be a valid email address|Value will be trimmed and converted to lowercase\n`text`|String|Required|—|Length must be less than 100 characters|Value will be trimmed\n`create_date`|Date|Not Required|Current date|—|—\n`update_date`|Date|Not Required|Current date|—|—\n\n#### Schema\n\n```\nconst Message = new mongoose.model('Message', new mongoose.Schema({\n\temail: {\n\t\ttype: String,\n\t\trequired: true,\n\t\ttrim: true,\n\t\tlowercase: true,\n\t\tmatch: [/^[a-zA-Z0-9.!#$%\u0026'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, 'Invalid email address']\n\t},\n\ttext: {\n\t\ttype: String,\n\t\trequired: true,\n\t\ttrim: true,\n\t\tmatch: [/^.{1,99}$/, 'Length must be less than 100 characters']\n\t},\n\tcreate_date: {\n\t\ttype: Date,\n\t\tdefault: Date.now\n\t},\n\tupdate_date: {\n\t\ttype: Date,\n\t\tdefault: Date.now\n\t}\n}));\n```\n\n**Note:** Regular expression to validate email [was recommended by W3C](https://www.w3.org/TR/html5/forms.html#valid-e-mail-address).\n\n### RESTful API\n\nURL|HTTP Method|Body of Request|Response\n:-----|:-----|:-----|:-----\n`/api/messages/list/:page`|`GET`|—|All messages from the given page\n`/api/messages/single/:id`|`GET`|—|Message with the given ID\n`/api/messages/`|`POST`|JSON|Created message\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbrazhnik%2Fchat-room-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvbrazhnik%2Fchat-room-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbrazhnik%2Fchat-room-api/lists"}