{"id":15190513,"url":"https://github.com/jbsmall17/blogging_api","last_synced_at":"2026-03-03T18:02:52.988Z","repository":{"id":204335154,"uuid":"711484082","full_name":"Jbsmall17/Blogging_API","owner":"Jbsmall17","description":"This is a CRUD RESTful API that allows users (unauthenticated and authenticated) to read blogs. Only authenticated users can create, update, and delete blogs.","archived":false,"fork":false,"pushed_at":"2023-10-29T21:55:10.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-21T18:03:10.856Z","etag":null,"topics":["jest","mongodb","mongodb-memory-server","mongoosejs","nodejs","passportjs","wiston-logger"],"latest_commit_sha":null,"homepage":"https://blog-api-ljcf.onrender.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/Jbsmall17.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":"2023-10-29T12:13:50.000Z","updated_at":"2024-08-06T17:22:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cae6894-62ba-45f1-a839-efd086de43cf","html_url":"https://github.com/Jbsmall17/Blogging_API","commit_stats":null,"previous_names":["jbsmall17/blogging_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jbsmall17/Blogging_API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jbsmall17%2FBlogging_API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jbsmall17%2FBlogging_API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jbsmall17%2FBlogging_API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jbsmall17%2FBlogging_API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jbsmall17","download_url":"https://codeload.github.com/Jbsmall17/Blogging_API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jbsmall17%2FBlogging_API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T17:46:22.538Z","status":"ssl_error","status_checked_at":"2026-03-03T17:46:22.036Z","response_time":61,"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":["jest","mongodb","mongodb-memory-server","mongoosejs","nodejs","passportjs","wiston-logger"],"created_at":"2024-09-27T20:40:23.477Z","updated_at":"2026-03-03T18:02:52.970Z","avatar_url":"https://github.com/Jbsmall17.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blogging API Documentation\n\n## Introduction\n\nThe Blogging API is designed to allow users to create, manage, and share blog posts. This API provides various endpoints and features for user management, authentication, and blog post operations.\n\nGeneral Endpoint : http://localhost:4000   (local)\n\n## How to get All get blogs\n- this is an unprotected route open to everyone(user and none users)\n- Blogs are paginated : a total od 20 post per page\n- Blogs can be searched by author, title, and tag.\n- Blogs can be ordered by read count, reading time, and timestamp.\n\n**HTTP Method:** `GET`\n**URL:** `/`\n\n**request**\n-**query**\n    -author: a string  (optional)\n    -title:  a string  (optional)\n    -tag :  a string  (optional)\n    -order: this could a value of either read_count, reading_time, and timestamp.\n\n\n\n\n\n## Authentication\n\n### JWT Authentication\n\n- To have access to, to certain functionalities user must sign up anf obtain a jwt\n- jwt expires in an hour\n\n### User Registration\n\nEndpoint: user signup\n\n**HTTP Method:** `POST`\n**URL:** `/signup`\n\n\n**Description:**\nCreate a new user.\n\n\n**Request:**\n\n- **Body:**\n  ```json\n  {\n    \"email\" : \"johndoe@gmail.com\",\n    \"password\" : \"anypasswordofyourchoice\",\n    \"first_name\" : \"john\",\n    \"last_name\" : \"doe\"\n  }\n\n**Request:**\nstatus code : 201\n\n\n{\n    \"message\": \"user created successfully\",\n    \"data\": {\n        \"email\": \"johndoe@gmail.com\",\n        \"first_name\": \"john\",\n        \"last_name\": \"doe\",\n        \"password\": \"$2b$10$.CLvV.ozUJhZR37ga7ZSPOClFO44xDUcBLSCQT654o0HExHy0kZsm\",\n        \"created_at\": \"2023-10-29T09:23:43.475Z\",\n        \"user_type\": \"user\",\n        \"_id\": \"l-fWPfGOo\",\n        \"__v\": 0\n    }\n}\n\n\n### User Sign-In\n\n- Registered users can sign in with their email and password to obtain a JWT.\n\nEndpoint: user signup\n\n**HTTP Method:** `POST`\n**URL:** `/login`\n\n\n**Description:**\nlogin a user.\n\n\n**Request:**\n\n- **Body:**\n  ```json\n  {\n    \"email\" : \"johndoe@gmail.com\",\n    \"password\" : \"anypasswordofyourchoice\",\n  }\n\n**Request:**\nstatus code : 200\n-** your resonpse will be similar to this **\n\n{\n    \"message\": \"Logged in Successfully\",\n    \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Il9pZCI6InRwT3g0Z29WdSIsImVtYWlsIjoiYWxhb2FiZHVsQGdtYWlsLmNvbSIsImxhc3RfbmFtZSI6ImFyYW1pZGUifSwiaWF0IjoxNjk4NTcyODUzLCJleHAiOjE2OTg1NzY0NTN9.tibyF4c8SgBClUxUFtXXoh-nuYQvaTuH47h9HcMgOAg\"\n}\n\n\n\n### Blog States\n\n- Blogs can be in two states: draft and published.\n- New blogs are created in the draft state.\n- Blog owners can update the state to published.\n\n\n### Creating a Blog\n\n- Only Authenticated users can create a blog.\n\nEndpoint: Create a Blog\n\n**HTTP Method:** `POST`\n**URL:** `/blog`\n\n**Description:**\nCreate a new blog post.\n\n**Request:**\n\n- **Headers:**\n  - `Authorization`: Bearer JWT Token (for authentication)\n\n\n- **Body:**\nAccepted tags: sport, technology, science and politics\ntilte format : \u003ctag\u003e-news (for examplse : sport-news, tech-news, science-news, politics-news) \n\n  ```json\n  {\n    \"title\" : \"sport-news\",\n    \"body\" : \"sport! sport!! sport!!! sport!!!! sport!!!!!\",\n    \"tag\" : \"sport\"\n  }\n\n**Response**\nstatus code 200\n-** your resonpse will be similar to this **\n{\n    \"message\": \"blog created successfully\",\n    \"data\": {\n        \"title\": \"sport-news\",\n        \"author\": \"aramide\",\n        \"body\": \"sport! sport!! sport!!! sport!!!! sport!!!!!\",\n        \"user_id\": \"tpOx4goVu\",\n        \"state\": \"draft\",\n        \"read_count\": 0,\n        \"reading_time\": 1333.3333333333335,\n        \"tag\": \"sport\",\n        \"timeStamp\": \"2023-10-29T02:36:36.382Z\",\n        \"_id\": \"9OubcVKDY\",\n        \"__v\": 0\n    }\n}\n\n\n### Updating a Blog\n\n- The owner of a blog can update the state of  its content,.\n- Blog state can be changed from draft to published by the owner.\n\nEndpoint: update a blog\n\n\n\n**HTTP Method:** `PATCH`\n**URL:** `/blog/:id`\n\n**Description:**\nupdate a blog post.\n\n**Request**\n\n- **Params:**\n  - `id`: value of _id of a blog post\n\n- **Headers:**\n  - `Authorization`: Bearer JWT Token (for authentication)\n\n- **Body:**\n  -body not required\n\n\n**Response**\nyour response will be similar to this\n\n{\n    \"message\": \"updated successfully\",\n    \"data\": {\n        \"_id\": \"9OubcVKDY\",\n        \"title\": \"sport-news\",\n        \"author\": \"aramide\",\n        \"body\": \"sport! sport!! sport!!! sport!!!! sport!!!!!\",\n        \"user_id\": \"tpOx4goVu\",\n        \"state\": \"publish\",\n        \"read_count\": 0,\n        \"reading_time\": 1333.3333333333335,\n        \"tag\": \"sport\",\n        \"timeStamp\": \"2023-10-29T02:36:36.382Z\",\n        \"__v\": 0\n    }\n}\n\n\n### list all blogs of the user\n\n- only user can perform this function \n- response is paginated\n- it can filterable by state: draft or published\n\n**HTTP Method:** `GET`\n**URL:** `/blog`\n\n**Request**\n\n- **query**\n    -page: takes a digit (optional)\n    -limit: take a digit (optional)\n    -state : it could either be draft or publish \n\nhow the url look like when all query are applied\n\n**URL:** `/blog?page=1\u0026limit=5\u0026state=draft`\n\n\n\n### get a blog of a user\n\n**HTTP Method:** `GET`\n**URL:** `/blog/:id`\n\n**Request**\n\n- **params**\n    id : value of _id of one the users blog \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbsmall17%2Fblogging_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbsmall17%2Fblogging_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbsmall17%2Fblogging_api/lists"}