{"id":15581155,"url":"https://github.com/01zulfi/journal-api","last_synced_at":"2026-05-01T08:32:33.983Z","repository":{"id":117560957,"uuid":"489874455","full_name":"01zulfi/journal-api","owner":"01zulfi","description":"A REST API for my journal frontend applications","archived":false,"fork":false,"pushed_at":"2024-06-15T08:44:16.000Z","size":186,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T08:26:26.807Z","etag":null,"topics":["cyclic","express","jwt","mongodb","nodejs","passportjs","rest-api"],"latest_commit_sha":null,"homepage":"https://journal-api.adaptable.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/01zulfi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-05-08T07:22:17.000Z","updated_at":"2024-06-15T08:44:19.000Z","dependencies_parsed_at":"2024-06-15T09:43:03.649Z","dependency_job_id":"4e86adc0-14e0-4efd-afdf-497a2eeb6787","html_url":"https://github.com/01zulfi/journal-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/01zulfi/journal-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01zulfi%2Fjournal-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01zulfi%2Fjournal-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01zulfi%2Fjournal-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01zulfi%2Fjournal-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/01zulfi","download_url":"https://codeload.github.com/01zulfi/journal-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01zulfi%2Fjournal-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32490810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cyclic","express","jwt","mongodb","nodejs","passportjs","rest-api"],"created_at":"2024-10-02T19:41:42.358Z","updated_at":"2026-05-01T08:32:33.953Z","avatar_url":"https://github.com/01zulfi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Journal API\n\n#### Link: https://journal-api.adaptable.app/ \n\n## About\n\nA RESTful API that serves my [Journal Admin](https://journal-admin.netlify.app/) and [Journal](https://01zulfi.github.io/journal) frontend applications. It allows to create a user for the database to safely interact with the admin app via JWT tokens. And utilizes a RESTful architecture to perform CRUD operations for the journals.\n\n## Technologies\n\n- Written in a NodeJS Framework: [Express](https://expressjs.com/)\n- Uses a RESTful architecture \n- Utilizes [MongoDB](https://www.mongodb.com/) for database needs\n- Leverages [JSON Web Tokens](https://jwt.io/) and [Passport.js](https://www.passportjs.org/) for authentication\n- Hosted on [Cyclic](https://www.cyclic.sh/)\n\n## Getting Started\n\n1. Clone the repository: \n```bash\ngit clone git@github.com:01zulfi/journal-api.git\n```\n2. Install dependencies:\n```bash\nnpm install\n```\n3. Spin up a database on [MongoDB](https://www.mongodb.com/)\n4. Add a `.env` file with the following:\n```\nMONGODB_URL=\"your mongodb connection url here\"\nSECRET=\"any random long string here\"\n```\n5. Create a user (don't include spaces in username and password):\n```bash\nnode create-user.js \u003cusername_here\u003e \u003cpassword_here\u003e\n```\n6. Start the server:\n```bash\nnpm run serverstart\n```\n\n## API Endpoints\n\n### Unprotected Routes\n\n#### 1. `/login`\n   - Accepts POST HTTP request\n   - Requires a `username` and `password` in request body (`req.body`)\n   - Sends a jwt token (accessible with `token` property). The token should be saved client side (localStorage), since they are required to access the protected routes\n   \n#### 2. `/published`\n   - A GET HTTP request sends back the list of published journals (accessible with `journals` property)\n  \n#### 3. `/published/:urlName`\n   - A GET HTTP request sends back a journal (`journal`) with the corresponding `urlName` property\n\n### Protected Routes\n\nNote: All requests to the following routes must be accompanied with a Authorization Header set to `\"bearer ${jwt_token_here}\"`\n\n#### 4. `/journal`\n   - A GET HTTP request sends back the list of all journals (`journals`) in the database\n   - A POST HTTP request saves journal in the database. Requires following properties in the request body: `title`, `urlName`, `content`. `publish` is an optional property. Afterwards, the new `journal` is sent back \n\n#### 5. `/journal/:id`\n  - A PUT HTTP request updates a journal with the corresponding `_id` property. Works similarly to the POST `/journal`\n  - A DELETE HTTP request deletes a journal with the corresponding `_id` property\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01zulfi%2Fjournal-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F01zulfi%2Fjournal-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01zulfi%2Fjournal-api/lists"}