{"id":24961326,"url":"https://github.com/streammedev/parrot-server","last_synced_at":"2025-03-28T22:27:37.719Z","repository":{"id":57163124,"uuid":"76508144","full_name":"StreamMeDev/parrot-server","owner":"StreamMeDev","description":"Simple server responds to any HTTP request with details about the request.","archived":false,"fork":false,"pushed_at":"2017-01-17T21:43:48.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-29T05:41:45.558Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StreamMeDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-15T00:20:54.000Z","updated_at":"2022-09-28T12:50:27.000Z","dependencies_parsed_at":"2022-09-01T00:20:07.958Z","dependency_job_id":null,"html_url":"https://github.com/StreamMeDev/parrot-server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StreamMeDev%2Fparrot-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StreamMeDev%2Fparrot-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StreamMeDev%2Fparrot-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StreamMeDev%2Fparrot-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StreamMeDev","download_url":"https://codeload.github.com/StreamMeDev/parrot-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246108357,"owners_count":20724715,"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":"2025-02-03T08:52:09.022Z","updated_at":"2025-03-28T22:27:37.699Z","avatar_url":"https://github.com/StreamMeDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parrot Server\n[![js-happiness-style](https://img.shields.io/badge/code%20style-happiness-brightgreen.svg)](https://github.com/JedWatson/happiness)\n\nSimple server responds to any HTTP request with details about the request.\n\n## Install\n```javascript\nnpm install @streammedev/parrot-server;\n```\n\n## Usage\nFirst, import the class:\n```javascript\nimport ParrotServer from '@streammedev/parrot-server';\n```\nNext, instantiate it:\n```javascript\nconst server = new ParrotServer();\n```\nNext, start it:\n```\nserver.start();\n```\nYour server is now accepting requests at `http://localhost`.\n\nOnce you're done, stop the server by calling `stop`, ie:\n\n```javascript\nserver.stop();  \n```\n\n## API\n`constructor(port)` - Instantiates a new server instance on the specified (optional) port. Whether it is set explicitly or not, server.port will be set to the port once the server has started.\n\n`start(cb)` - Starts the server, then calls the (optional) callback.\n\n`stop(cb)` - Stops the server, then calls the (optional) callback.\n\n## CLI\nA simple cli command is available:\n\n```bash\nparrot-server --port=8080\n```\n\n## Example\n```javascript\nimport ParrotServer from '@streammedev/parrot-server';\nimport assert from 'assert';\nimport request from 'request';\n\ndescribe('do some test', function () {\n\tlet testServer;\n\tbefore(function (done) {\n\t\ttestServer = new ParrotServer(port);\n\t\ttestServer.start(done);\n\t});\n\tafter(function (done) {\n\t\ttestServer.stop(done);\n\t});\n  it('should get my endpoint', function(done) {\n    request('http://localhost/my-endpoint?q=findme', function (error, response, body) {\n      assert.ifError(error);\n      assert.ifError(response.statusCode !== 200);\n      assert.strictEqual(body.method, 'GET', 'it should be a GET request');\n      assert.strictEqual(body.path, 'my-endpoint', 'it should have the right path');\n      assert.strictEqual(body.query.q, 'findme', 'it should set the q query parameter');\n      })\n    })\n  })\n}\n```\n\n## Contributing\n\nContributions are welcome.\nPlease see our guidelines in [CONTRIBUTING.md](contributing.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreammedev%2Fparrot-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreammedev%2Fparrot-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreammedev%2Fparrot-server/lists"}