{"id":15646165,"url":"https://github.com/softchris/mini-web","last_synced_at":"2025-04-28T16:04:09.570Z","repository":{"id":39453714,"uuid":"273233776","full_name":"softchris/mini-web","owner":"softchris","description":"Minimalistic Web framework for Node.js, 0 dependencies","archived":false,"fork":false,"pushed_at":"2023-01-24T02:59:17.000Z","size":1082,"stargazers_count":50,"open_issues_count":19,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T16:02:50.635Z","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/softchris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-18T12:37:24.000Z","updated_at":"2024-06-18T13:41:26.000Z","dependencies_parsed_at":"2023-02-13T14:00:56.687Z","dependency_job_id":null,"html_url":"https://github.com/softchris/mini-web","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Fmini-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Fmini-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Fmini-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Fmini-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softchris","download_url":"https://codeload.github.com/softchris/mini-web/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342721,"owners_count":21574244,"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":[],"created_at":"2024-10-03T12:11:40.226Z","updated_at":"2025-04-28T16:04:09.205Z","avatar_url":"https://github.com/softchris.png","language":"JavaScript","readme":"[![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?color=blue\u0026style=flat-square)](http://opensource.org/licenses/MIT)\n![Coverage](./badges/coverage.svg)\n[![npm version](https://badge.fury.io/js/quarkhttp.svg)](https://www.npmjs.com/package/quarkhttp)\n[![npm downloads](https://img.shields.io/npm/dm/quarkhttp?color=blue\u0026label=npm%20downloads\u0026style=flat-square)](https://www.npmjs.com/package/quarkhttp)\n\n## Table of Contents\n\n- [About](#about)\n- [Install](#install)\n- [Features](#features)\n- [Create an app](#create-an-app)\n\n## About\n\nThis is a minimalistic Web framework for Node.js. It helps you create RESTful APIs.\n\nThe idea is to have 0 dependencies while still have all the functionality you would expect from bigger frameworks like Express, Koa, Fastify etc with just a fraction of the footprint.\n\n## Install\n\n```bash\nnpm install quarkhttp\n```\n\n## Features\n\n- Create routes supporting GET, POST, PUT, DELETE HTTP Verbs. There are convenience methods for this:\n\n   ```javascript\n   app.get('\u003cpath\u003e', (req, res) =\u003e {})\n   app.post('\u003cpath\u003e', (req, res) =\u003e {})\n   app.put('\u003cpath\u003e', (req, res) =\u003e {})\n   app.delete('\u003cpath\u003e', (req, res) =\u003e {})\n   ```\n\n- Reads posted body to either Text or JSON. Use method `bodyParse(method)` to change how the body is parsed. Valid input values `json` or `text`.\n- Has middleware that you can run before handling the actual request. Can be used for Authentication for example.\n\n   ```javascript\n   app.get('/products', (req, res, next) =\u003e {\n     if (req.headers['authorization'] === 'abc123') {\n       next();\n     } else {\n       res.statusCode = 401;\n       res.send('Not allowed')\n     }\n   })\n   ```\n\n- Handles route parameters and query parameters\n\n   **Router parameters**\n\n   ```javascript\n   app.get('/products/:id', (req, res) =\u003e {\n     console.log(req.params) // for route /products/1 { id: \"1\" }\n   })\n   ```\n\n   **Query parameters**\n\n   ```javascript\n   app.get('/products/', (req, res) =\u003e {\n     console.log(req.query) // for route /products?page=1\u0026pageSize=20 { page: \"1\", pageSize: \"20\"}\n   })\n   ```\n\n## Create an app\n\n```javascript\nconst quark = require('quarkhttp');\n\nconst app = quark();\n\n// ROUTE PARAMETERS\napp.get(\"/products/:id\", (req, res) =\u003e {\n  console.log(\"query params\", req.query);\n  console.log('req.params', req.params);\n  res.send(\"product id\");\n});\n\napp.get('/products', (req, res) =\u003e {\n  console.log('query params', req.query)\n  res.send('text');\n})\n\n// POST\napp.post('/products', (req,res) =\u003e {\n  console.info('body', req.body)\n  res.json(req.body);\n})\n\n// PUT\napp.put('/products', (req,res) =\u003e {\n  console.info('body', req.body)\n  res.json(req.body);\n})\n\n// MIDDLEWARE\napp.get('/orders', (req, res, next) =\u003e {\n  if (req.headers['authorization'] === 'abc123') {\n    console.log('next', next)\n    next()\n  } else {\n    res.statusCode = 401;\n    res.send('Not allowed')\n  }\n}, (req, res) =\u003e {\n  res.send('Protected route');\n})\n\n// Starts listening to requests\napp.listen(3000, () =\u003e {\n  console.log('Server running on 3000');\n})\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchris%2Fmini-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftchris%2Fmini-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchris%2Fmini-web/lists"}