{"id":24599677,"url":"https://github.com/gfilho/base-server","last_synced_at":"2025-03-18T06:27:51.200Z","repository":{"id":143749708,"uuid":"182578094","full_name":"gfilho/base-server","owner":"gfilho","description":"A lightweight wrapper for Express that allows easily setup HTTP headers and SSL.","archived":false,"fork":false,"pushed_at":"2019-05-15T04:11:07.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T20:38:09.235Z","etag":null,"topics":["api","app","expres","http-header","https","javascript","rest","restful","router","ssl"],"latest_commit_sha":null,"homepage":"","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/gfilho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-04-21T20:14:08.000Z","updated_at":"2019-05-15T04:18:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"9195b178-b0e8-490c-ab95-c5a024a5133e","html_url":"https://github.com/gfilho/base-server","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":0.04347826086956519,"last_synced_commit":"01f93f201d192874123171297eaa6fc4cc7d9f42"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfilho%2Fbase-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfilho%2Fbase-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfilho%2Fbase-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfilho%2Fbase-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gfilho","download_url":"https://codeload.github.com/gfilho/base-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243742035,"owners_count":20340563,"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":["api","app","expres","http-header","https","javascript","rest","restful","router","ssl"],"created_at":"2025-01-24T13:16:44.930Z","updated_at":"2025-03-18T06:27:51.183Z","avatar_url":"https://github.com/gfilho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @gfilho/base-server\nA lightweight wrapper for Express that allows easily setup HTTP headers and SSL.\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8de6566518794445a0211569e86e9ae3)](https://app.codacy.com/app/gfilho/base-server?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=gfilho/base-server\u0026utm_campaign=Badge_Grade_Dashboard)\n[![Build Status](https://travis-ci.com/gfilho/base-server.svg?branch=master)](https://travis-ci.com/gfilho/base-server)\n[![codecov](https://codecov.io/gh/gfilho/base-server/branch/master/graph/badge.svg)](https://codecov.io/gh/gfilho/base-server)\n\n## Getting Started\n\n### Installation\n\n```bashp\nnpm install @gfilho/base-server --save\n```\n\n### Simple Server\nThis is example show how create a simple REST server using the @gfilho/base-server:\n\n``` js\nvar Server = require('@gfilho/base-server');\n\n// Setup Server\nconst config = {\n  router: {\n    address: 'api',\n    port: 1234,\n  },\n};\n\n// Instance of Server\nconst server = new Server(config);\n\n// Bind requests\nserver.get('/ping', (req, res) =\u003e {\n  res.json({ msg: 'Ops! I received a GET' });\n});\n\n// Run Server\nserver.start();\n```\n\n### Complete Server\nThis is example show a REST server using all features allowed by @gfilho/base-server:\n``` js\nvar Server = require('@gfilho/base-server');\n\n// Setup Server\nconst config = {\n  router: {\n    address: 'api',\n    port: 1234,\n    header: {\n      allowedMethods: 'GET PUT POST DEL',\n      allowedHost: 'mydomain.com',\n      allowedHeaders: 'MySpecialHeader',\n      allowedCredentials: true,\n    },\n    ssl: {\n      key: 'examples/ssl/key.pem',\n      certificate: 'examples/ssl/server.crt',\n    },\n  },\n};\n\n// Instance of Server\nconst server = new Server(config);\n\n// Bind requests\nserver.get('/ping', (req, res) =\u003e {\n  res.json({ msg: 'Server https is alive' });\n});\n\nserver.put('/ping', (req, res) =\u003e {\n  res.json({ msg: 'Ops! I received a PUT' });\n});\n\nserver.post('/ping', (req, res) =\u003e {\n  res.json({ msg: 'Ops! I received a POST' });\n});\n\nserver.delete('/ping', (req, res) =\u003e {\n  res.json({ msg: 'Ops! I received a DEL' });\n});\n\n// Run Server\nserver.start();\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfilho%2Fbase-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgfilho%2Fbase-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfilho%2Fbase-server/lists"}