{"id":27251526,"url":"https://github.com/luiseduardofrias/httpc","last_synced_at":"2026-04-10T15:46:28.603Z","repository":{"id":179261688,"uuid":"663214496","full_name":"LuisEduardoFrias/HttpC","owner":"LuisEduardoFrias","description":"The HTTPC library is a tool that enables the visual exploration and querying of endpoints in an Express application in a graphical manner. By integrating this library into your project, a /httpc route is added, providing an interactive web interface similar to Swagger in ASP.NET. Through this interface, developers can directly explore and test the ","archived":false,"fork":false,"pushed_at":"2024-08-07T15:18:39.000Z","size":1152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-07T18:26:17.288Z","etag":null,"topics":["css3","ejs","html5","js","json","restful-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/LuisEduardoFrias.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,"zenodo":null}},"created_at":"2023-07-06T20:08:55.000Z","updated_at":"2024-08-07T15:18:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2592884-b860-4434-b5b0-5068e41e6f3a","html_url":"https://github.com/LuisEduardoFrias/HttpC","commit_stats":null,"previous_names":["luiseduardofrias/httpc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuisEduardoFrias%2FHttpC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuisEduardoFrias%2FHttpC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuisEduardoFrias%2FHttpC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuisEduardoFrias%2FHttpC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuisEduardoFrias","download_url":"https://codeload.github.com/LuisEduardoFrias/HttpC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322600,"owners_count":21084337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["css3","ejs","html5","js","json","restful-api"],"created_at":"2025-04-11T01:10:13.861Z","updated_at":"2025-12-30T23:05:07.840Z","avatar_url":"https://github.com/LuisEduardoFrias.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HttpC\n\n**HttpC** The HTTPC library is a tool that enables the visual exploration and querying of endpoints in an Express application in a graphical manner. By integrating this library into your project, a /api_httpc route is added, providing an interactive web interface similar to Swagger in ASP.NET. Through this interface, developers can directly explore and test the various endpoints of the Express application, including the ability to send parameters and data required for queries. HTTPC simplifies the development process by offering an intuitive and efficient way to interact with the API of the Express application.\n\nEste es un módulo de Node.js.\n\n##install\n\n$ npm install api_httpc\n$ yarn add api_httpc\n\n## api/apimodels/employer - file\n\n```javascript\n\nexport default class Employer {\n  constructor(fingerPrint, userCardId, userName, userLastName) {\n    super();\n    this.fingerPrint = fingerPrint;\n    this.userCardId = userCardId;\n    this.userName = userName;\n    this.userLastName = userLastName;\n  }\n}\n\n```\n\n## api/routes/employer - file\n\n```javascript\n// In this code, the router class from the 'api_httpc' library is used to define routes in the application.\n// The router class is imported from 'api_httpc' and used to create a router in Express.\nimport express from 'express';\nimport { router } from 'api_httpc';\nimport Employer from '../models/employer.js';\nimport { create, getAll, getById, update, remove, } from '../repositories/employer_repo.js';\n\n// The router class receives an Express object as a parameter in its constructor.\nconst app = new router(express);\n\n// Allows defining routes with the GET, POST, PUT, and DELETE methods, just like express.\n\n// Some functionalities of the router class:\n\n// - Allows the use of middleware with the use method to perform common actions on all routes.\napp.get('/:token',\n  (req, res, next) =\u003e {\n    const token = req.params.token;\n    const result = getAll(token);\n\n    if (!result) {\n      res.status(401).json({ message: 'Unauthorized' });\n      return;\n    }\n\n    if (result.error) {\n      res.status(500).json({ error: result.error });\n      return;\n    }\n\n    res.status(200).json(result.data);\n  });\n\n// Define routes using the POST method to handle POST requests. In these routes, you can specify an array of strings or the name of a class that identifies the JSON data expected in the request body.\n//create employe\napp.post(\n  '/:token',\n  (req, res, next) =\u003e {\n    const token = req.params.token;\n    const body = req.body;\n\n    const result = create(body, token);\n\n    if (!result) {\n      res.status(401).json({ message: 'Unauthorized' });\n      return;\n    }\n\n    if (result.error) {\n      res.status(500).json({ error: result.error });\n      return;\n    }\n\n    res.status(200).json(result);\n  },\n  Employer\n);\n\n/*\n* more endpoint\n*/\n\nconst employed = app.router();\nexport default employed;\n\n```\n\n## index file\n\n```javascript\n\nimport express from 'express';\nimport cors from 'cors';\nimport morgan from 'morgan';\n// Help api_httpc create an HTTP client to consume the endpoints created in Express.\nimport gateway from 'api_httpc';\n\nimport Company from './models/company.js';\n\nimport company from './routes/company.js';\n\n//----------------------------\n\nimport express from 'express';\nimport cors from 'cors';\nimport morgan from 'morgan';\nimport gateway from 'api_httpc';\n\nimport Admin from './models/admin.js';\n\nimport arrival_registration from './routes/arrival_registration.js';\nimport employed from './routes/employed.js';\nimport register from './routes/register.js';\n\n//----------------------------\n\n// The getAttribute class receives an Express object as a parameter in its constructor.\n// routes\nconst gate = new gateway(app);\n\n//settings\napp.set('protocol', 'http://');\napp.set('domain', 'localhost:');\napp.set('port', 8080); //process.env.port\n\n//middlewares\napp.use(express.text());\napp.use(express.json());\napp.use(express.urlencoded({ extended: false }));\napp.use(morgan('dev')); // combined\napp.use(\n  cors({\n    origin: 'http://localhost:3000',\n    accept: 'application/json',\n    methods: ['GET', 'POST', 'PUT', 'DELETE'],\n  })\n);\n\n// routes\nconst gate = new gateway(app);\n\n// - Define routes using the POST method to handle POST requests. In these routes, you can specify an array of strings or the name of a class that identifies the JSON data expected in the request body.\ngate.post(\"/areas\", (req, res, next) =\u003e {\n    const { number1, number2, number3 } = req.body;\n    \n    const num1 = parseInt(number1);\n    const num2 = parseInt(number2);\n    const num3 = parseInt(number3);\n\n    setTimeout(function () {\n        const result = num1 + (num2 - num3);\n        res.status(200).json({ message: \"post area\", data: result });\n    }, 3000);\n},[\"number1\",\"number2\",\"number3\"]);\n\ngate.routes('/register', register);\ngate.routes('/employed', employed);\ngate.routes('/arrival_registration', arrival_registration);\n\ngate.listen(() =\u003e console.log(`server on port:${app.get('port')}`));\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluiseduardofrias%2Fhttpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluiseduardofrias%2Fhttpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluiseduardofrias%2Fhttpc/lists"}