{"id":18614876,"url":"https://github.com/andrewjbateman/nodejs-tutorial-rest-api","last_synced_at":"2026-04-17T07:31:59.695Z","repository":{"id":44524208,"uuid":"167420205","full_name":"AndrewJBateman/nodejs-tutorial-rest-api","owner":"AndrewJBateman","description":":clipboard: This is an app to practise working with Representational State Transfer (REST) APIs that just transfer data instead of user interfaces.","archived":false,"fork":false,"pushed_at":"2023-03-04T03:06:56.000Z","size":568,"stargazers_count":0,"open_issues_count":13,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T01:34:26.602Z","etag":null,"topics":["bcrypt-nodejs","codepen","cors","crud","graphql","headers","mongoose-schema","multer","nodejs","postman-api","replace","rest-api","socket-io"],"latest_commit_sha":null,"homepage":"","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/AndrewJBateman.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-01-24T18:57:35.000Z","updated_at":"2022-04-12T09:16:10.000Z","dependencies_parsed_at":"2025-02-18T03:44:46.762Z","dependency_job_id":"ab85d71d-d8b8-4604-8eb0-263974572cf0","html_url":"https://github.com/AndrewJBateman/nodejs-tutorial-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewJBateman/nodejs-tutorial-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-tutorial-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-tutorial-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-tutorial-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-tutorial-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/nodejs-tutorial-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-tutorial-rest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31919937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"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":["bcrypt-nodejs","codepen","cors","crud","graphql","headers","mongoose-schema","multer","nodejs","postman-api","replace","rest-api","socket-io"],"created_at":"2024-11-07T03:27:16.493Z","updated_at":"2026-04-17T07:31:59.672Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Nodejs Tutorial Rest API\n\n* This is an app to practise working with Representational State Transfer (REST) APIs that just transfer data instead of user interfaces.\n\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/nodejs-tutorial-rest-api?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/nodejs-tutorial-rest-api?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/nodejs-tutorial-rest-api?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/nodejs-tutorial-rest-api?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: Nodejs Tutorial Rest API](#zap-nodejs-tutorial-rest-api)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* This app creates simple get and post routes/controllers to send and receive data, as well as header and status information.\n* A Postman API and a [Codepen REST API test app](https://codepen.io/AndrewJBateman/pen/dwbVaX?editors=0010) are used to send/receive data.\n\n## :camera: Screenshots\n\n![Example screenshot](./images/postman.png)\n\n## :signal_strength: Technologies\n\n* [multer v1](https://www.npmjs.com/package/multer) is the middleware used for uploading files.\n* [socket.io v2](https://socket.io/) is added for real-time event-based communications.\n* [graphql v14](https://www.graphql.org/) is added, a query language for APIs.\n* [bcrypt v2](https://www.npmjs.com/package/bcrypt) library used to hash passwords.\n* [mongoose v5](https://mongoosejs.com/) object modelling for node.js.\n* [VS Extension Thunder client](https://www.thunderclient.com/) REST Client for Testing APIs\n* [Codepen 'REST API test'](https://codepen.io/AndrewJBateman/pen/dwbVaX?editors=1010) used to test the app.\n\n## :floppy_disk: Setup\n\n* Create MongoDB Atlas Cloud database (or local installed MongoDB database) and add user access/database credentials to a new `.env` file - see `.env.example` - referred to in `app.js`.\n* Add IP address to MongoDB Atlas Network Access whitelist. Or simply whitelist all (IP address 0.0.0.0/0).\n* Run `npm start` for a dev server. Navigate to `http://localhost:8080/`. The app will automatically reload if you change any of the source files.\n\n## :computer: Code Examples\n\n* getPosts method from controllers\\feed.js\n\n```javascript\n\nexports.getPosts = async (req, res, next) =\u003e {\n  const currentPage = req.query.page || 1;\n  const perPage = 2;\n  try {\n    const totalItems = await Post.find().countDocuments();\n    const posts = await Post.find()\n      .populate('creator')\n      .sort({ createdAt: -1 })\n      .skip((currentPage - 1) * perPage)\n      .limit(perPage);\n\n        // return a response with json data\n    res.status(200).json({\n      message: 'Fetched posts successfully.',\n      posts: posts,\n      totalItems: totalItems\n    });\n  } catch (err) {\n    if (!err.statusCode) {\n      err.statusCode = 500;\n    }\n    next(err);\n  }\n};\n\n```\n\n## :cool: Features\n\n* None\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Part complete \u0026 working, Connects to database but nothing viewed on `localhost:8080`. `localhost:8080/graphql` works\n* To-Do: Complete code or replace. Also requires more commenting and screen shots.\n\n## :clap: Inspiration\n\n* [NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL sections 24 and other sections)](https://www.udemy.com/nodejs-the-complete-guide/).\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-tutorial-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fnodejs-tutorial-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-tutorial-rest-api/lists"}