{"id":17024945,"url":"https://github.com/devatreides/nodejs-proof-of-concept","last_synced_at":"2026-04-12T03:02:15.073Z","repository":{"id":143574590,"uuid":"242447488","full_name":"devatreides/nodejs-proof-of-concept","owner":"devatreides","description":"A short NodeJS application for testing some development concepts","archived":false,"fork":false,"pushed_at":"2020-04-08T02:30:15.000Z","size":1103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T18:44:49.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devatreides.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-02-23T03:06:31.000Z","updated_at":"2020-04-08T02:30:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f7ccc56-8985-4332-9747-df969e401d21","html_url":"https://github.com/devatreides/nodejs-proof-of-concept","commit_stats":null,"previous_names":["devatreides/nodejs-proof-of-concept"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devatreides/nodejs-proof-of-concept","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fnodejs-proof-of-concept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fnodejs-proof-of-concept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fnodejs-proof-of-concept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fnodejs-proof-of-concept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devatreides","download_url":"https://codeload.github.com/devatreides/nodejs-proof-of-concept/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fnodejs-proof-of-concept/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31702581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"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":[],"created_at":"2024-10-14T07:27:32.623Z","updated_at":"2026-04-12T03:02:15.037Z","avatar_url":"https://github.com/devatreides.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NodeJS: Proof of Concept\n\n![GitHub top language](https://img.shields.io/github/languages/top/tombenevides/nodejs-proof-of-concept)\n![GitHub last commit](https://img.shields.io/github/last-commit/tombenevides/nodejs-proof-of-concept)\n![GitHub Release Date](https://img.shields.io/github/release-date/tombenevides/nodejs-proof-of-concept)\n![GitHub issues](https://img.shields.io/github/issues/tombenevides/nodejs-proof-of-concept)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/tombenevides/nodejs-proof-of-concept)\n![GitHub contributors](https://img.shields.io/github/contributors/tombenevides/nodejs-proof-of-concept)\n![GitHub All Releases](https://img.shields.io/github/downloads/tombenevides/nodejs-proof-of-concept/total)\n![GitHub](https://img.shields.io/github/license/tombenevides/nodejs-proof-of-concept)\n\nA short NodeJS application for testing some development concepts such as http requests using express and the use of middlewares for entry validation.\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. For being a proof of concept, there's no deployment state for this project. You can also run this project with **Gitpod**, just clicking on the button on top of this repository. To know more about **Gitpod**, just click [here](https://www.gitpod.io/).\n\n### Prerequisites\n\nYou just need to have a **Node** version installed on your machine. In the case you don't have one, follow these [instructions](https://nodejs.org/en/download/package-manager/).\n\nThis application don't have a graphic interface, so you will need a tool for making the requests. There's many tools on the Internet, but I like these one: **Insomnia** and you can learn how to install it [here](https://insomnia.rest/download/). \n\n### Installing\n\nWith **Node** installed on your machine, clone this repository and then run this command on terminal inside the root project:\n\n```shell\nyarn install \u0026 yarn dev\n```\n\nIf you don't see any errors in the execution of the command above, open a browser and type this url: `http://localhost:3000/projects`. You should see something like this:\n\n![](.github/projects-browser.png)\n\nIf you like this kinda JSON presentation on the browser (In the case, Google Chrome), use the extension **JSON Viewer**. You can find it [here](https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh?hl=pt-BR). \n\n## Working with the Application\n\nThe operation of this application is very simple. We have five routes and you can manipulate data of an excuting time array, using the **non-blocking IO** concept from **Node**. If you want to know more about this concept, click [here](https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/).\n\n### The Routes\n\nThe application have five routes that implements a **CRUD** (Create-Read-Update-Delete) for projects, a fake form with some simple data: id, title and a list of tasks. Below, there is a short description of each route.\n\n\n- **[GET] /projects :** This route list all the projects saved on the server. For default, it begins with one project and the return is a list like this:\n\n```json\n[\n  {\n    \"id\": 1,\n    \"title\": \"Project 1\",\n    \"tasks\": [\n      \"task 1\",\n      \"task 2\"\n    ]\n  }\n]\n```\n\n- **[POST] /projects :** This route insert a new project on the server and demands 2 entrys: the **id** and the **title** of the project. The data is send to the server in a JSON format, like below:\n\n```json\n{\n  \"id\": 1,\n  \"title\": \"Project 2\"\n}\n```\n\n- **[POST] /projects/:id/tasks :** This route insert a new task in some project and demands 2 entrys: the **id** (using query params) and the **title** (use request body) of the project. The title is send to the server in a JSON format, like below:\n\n```json\n{\n  \"title\": \"Some Task To Do\"\n}\n```\n\n- **[PUT] /projects/:id :** This route edit a specific project, but only the title. It demands 2 entrys: the **id** (using query params) and the new **title** for the project. The title data is send to the server in a JSON format, like below:\n\n```json\n{\n  \"title\": \"New Project title\"\n}\n```\n\n- **[DELETE] /projects:id :** This route deletes a specific project. It demands an entry: the **id** (using query params).\n\n### The Middlewares\n\nBy definition, **middleware** is a software that serves common resources to multiple applications. Using the same principle, we have some functions that serves common resources to multiple requests, such as logging and validation. This project have 3 middlewares: **countRequest**, **checkExistingProject** and **checkPostEntrys**.\n\n- The middleware **countRequests()** log the application printing some data about the request, besides the number of requests made so far to the server. It prints something like this:\n\n```shell\n1 requests so far\nmethod: GET; URL: /projects\nRequest time: 6.112ms\n```\n\n- The middleware **checkExistingProject()** checks if a project exists on the server based on the id parameter passed from client. If everything is OK, the execution go on, but if is not, a message with http 400 status code will be returned like this:\n\n```json\n{\n  \"error\": \"Project not found\"\n}\n```\n\n- The middleware **checkPostEntrys()** checks if the entrys of a request matches wich is expected from the request url. If everything is OK, the execution go on, but if is not, a message with http 400 status code will be returned like this:\n\n```json\n{\n  \"error\": \"Parameters missing\"\n}\n```\n\n## Built With\n\n* [NodeJS](https://nodejs.org/en/about/) - The interpreter used\n* [Express](http://expressjs.com/) - The framework used\n\n## Author\n\n* **Tom Benevides** - *Like a barber in Seville* ([Dev.to](https://dev.to/tombenevides) - [Instagram](https://instagram.com/tombenevides3))\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevatreides%2Fnodejs-proof-of-concept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevatreides%2Fnodejs-proof-of-concept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevatreides%2Fnodejs-proof-of-concept/lists"}