{"id":28234292,"url":"https://github.com/azlanibrahim1/rest-api","last_synced_at":"2026-05-05T19:31:55.932Z","repository":{"id":268767005,"uuid":"901791585","full_name":"azlanibrahim1/rest-api","owner":"azlanibrahim1","description":"A simple REST API built using Node.js, Express, and MongoDB.","archived":false,"fork":false,"pushed_at":"2024-12-11T10:20:06.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T19:06:18.160Z","etag":null,"topics":["express","mongodb","nodejs","rest-api"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/azlanibrahim1.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":"2024-12-11T10:19:55.000Z","updated_at":"2025-01-30T07:21:04.000Z","dependencies_parsed_at":"2024-12-18T19:53:47.215Z","dependency_job_id":"c4fee5e6-0cf0-46e5-8f70-6d7e5ba110a6","html_url":"https://github.com/azlanibrahim1/rest-api","commit_stats":null,"previous_names":["azlibdar/rest-api","azlanibrahim1/rest-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azlanibrahim1/rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azlanibrahim1%2Frest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azlanibrahim1%2Frest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azlanibrahim1%2Frest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azlanibrahim1%2Frest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azlanibrahim1","download_url":"https://codeload.github.com/azlanibrahim1/rest-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azlanibrahim1%2Frest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32664817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["express","mongodb","nodejs","rest-api"],"created_at":"2025-05-18T22:13:29.570Z","updated_at":"2026-05-05T19:31:55.913Z","avatar_url":"https://github.com/azlanibrahim1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST _APIs_\n\nThis project is a simple REST API built using Node.js, Express, and MongoDB. It supports basic CRUD (Create, Read, Update, Delete) operations for user management.\n\n\u003e As a frontend developer, I created this project to gain a deeper understanding of how REST APIs function.\n\n\u003chr\u003e\n\n## Getting Started\n\n### Prerequisites\n\nMake sure you have the following installed before starting:\n\n- Node.js\n- MongoDB - You can create a free MongoDB Atlas account [here](https://www.mongodb.com/cloud/atlas/register).\n\n### Installation\n\n#### 1. Clone the repository:\n\n```sh\n  git clone https://github.com/azlibdar/rest-api.git\n  cd rest-api\n```\n\n#### 2. Install the dependencies:\n\n```sh\n  npm install\n```\n\n#### 3. Environment Configuration:\n\n1. Create a `.env` file in the project root\n2. Copy contents from `.env.example`\n3. Fill in your specific configuration:\n\n   ```env\n   MONGO_URI=\u003cYour MongoDB URI\u003e\n   # Connection string for your MongoDB database.\n\n   CORS_ORIGIN=http://localhost:8080\n   # Allowed origin for Cross-Origin Resource Sharing (CORS).\n\n   AUTH_SECRET=\u003cYour Auth Secret\u003e\n   # Used for authentication and password hashing. Defaults to `AZLAN-REST-API` if not provided.\n   ```\n\n#### 4. Start the application:\n\n```sh\n  npm start\n```\n\n\u003e The server will be running on `http://localhost:8080`.\n\n\u003cbr\u003e\n\u003chr\u003e\n\u003cbr\u003e\n\n## API Endpoints\n\n### Authentication\n\n#### 1. Register a new user\n\n```plain\nRoute (POST): /auth/register\nRequest body: { \"username\": \"abc\", \"email\": \"abc@example.com\", \"password\": \"abc123\" }\n```\n\n#### 2. Login a user\n\n```plain\nRoute (POST): /auth/login\nRequest body: { \"email\": \"abc@example.com\", \"password\": \"abc123\" }\n\nResponse: A session token will be generated.\n```\n\n#### 3. Logout user\n\n```plain\nRoute (POST): /auth/logout\nRequest body: N/A\n\nResponse: The user's session token will be invalidated.\n```\n\n### User Management\n\n#### 1. Get all users\n\n```plain\nRoute (GET): /list-users\nRequest body: N/A\n\nAuthentication required.\n```\n\n#### 2. Delete a user account\n\n```plain\nRoute (DELETE): /delete-account/:id\nRequest body: N/A\n\nAuthentication required. User must be the owner of the account.\n```\n\n#### 3. Change password\n\n```plain\nRoute (PATCH): /change-password/:id\nRequest body: { \"oldPassword\": \"123\", \"newPassword\": \"1234\" }\nResponse: The user's session token will be invalidated, and a new salt will be generated.\n\nAuthentication required. User must be the owner of the account.\n```\n\n\u003cbr\u003e\n\u003chr\u003e\n\u003cbr\u003e\n\nContributions are welcome! Feel free to suggest features, report issues, or submit pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazlanibrahim1%2Frest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazlanibrahim1%2Frest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazlanibrahim1%2Frest-api/lists"}