{"id":21668524,"url":"https://github.com/christoph-jerolimov/beta-middleware","last_synced_at":"2026-05-06T13:38:05.206Z","repository":{"id":19572491,"uuid":"22821926","full_name":"christoph-jerolimov/beta-middleware","owner":"christoph-jerolimov","description":"A lightweight (stupid) solution to save beta forms.","archived":false,"fork":false,"pushed_at":"2014-08-11T01:33:26.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T16:45:42.733Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christoph-jerolimov.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}},"created_at":"2014-08-11T00:22:38.000Z","updated_at":"2014-08-11T00:22:54.000Z","dependencies_parsed_at":"2022-08-24T13:40:46.339Z","dependency_job_id":null,"html_url":"https://github.com/christoph-jerolimov/beta-middleware","commit_stats":null,"previous_names":["christoph-jerolimov/beta-middleware"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoph-jerolimov%2Fbeta-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoph-jerolimov%2Fbeta-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoph-jerolimov%2Fbeta-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoph-jerolimov%2Fbeta-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christoph-jerolimov","download_url":"https://codeload.github.com/christoph-jerolimov/beta-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566948,"owners_count":20473451,"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-11-25T12:16:20.903Z","updated_at":"2025-10-29T04:07:06.189Z","avatar_url":"https://github.com/christoph-jerolimov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A lightweight (stupid) solution to save beta forms.\n\n### Installation\n\n    npm install beta-middleware --save\n\n### Integration as route\n\n```javascript\nvar beta = require('beta-middleware');\n\napp.get('/beta/beta.js', beta.provideClientAPI());\n\napp.post('/beta/:type', beta.route(function(data, callback) {\n    mongoose.save(data, callback);\n}));\n```\n\n| Option | Default value | Description |\n|---|---|---|\n| saveHeaders | true | Includes `req.headers` into the persistent information. |\n| saveCookies | false | Includes `req.cookies` into the persistent information. |\n| saveSignedCookies | false | Includes `req.signedCookies` into the persistent information. |\n| saveSession | false | Includes `req.session` into the persistent information. |\n\n### Integration as middleware\n\n```javascript\nvar beta = require('beta-middleware');\n\napp.get('/beta/beta.js', beta.provideClientAPI());\n\napp.post('/beta/:type', beta.middleware(function(data, callback) {\n   mongoose.save(data, callback);\n}), function(req, res) {\n    res.render('registration_successful');\n});\n```\n\nAdditional options (+ save options from above):\n\n| Option | Default value | Description |\n|---|---|---|\n| successLocation | - | Redirect URL when information are saved successfully.\u003cbr/\u003eIf defined the `Location` will set with status code 201. Status 201 without any data will be returned otherwise. |\n| errorLocation | - | Redirect URL when an error occurred.\u003cbr/\u003eIf defined the `Location` will set with status code 301. Next middleware will be called with an error otherwise. |\n\n### Full REST service based on Express\n\n```javascript\nvar express = require('express'),\n\tmongoose = require('mongoose'),\n\tbeta = require('beta-middleware/integration/express-mongoose');\n\napp.use('/beta', beta(express, mongoose, {\n    readSecret:   'sWZGTh7GiCXTuE3qJHmz5B3tNDwdV3Fb',  // replace this\n    deleteSecret: 'MNI2kToBnuIhjFk26IvVBrz83UFnfzcw'   // secret keys!\n}));\n```\n\n| Route | Status code |\n|---|---|\n| `POST /beta` | 201 when successful\u003cbr/\u003e301 when an error occurs |\n| `GET /beta[?filter]`\u003cbr/\u003e\u003cbr/\u003efilter example: ?query.abtesting=42 | 200 when successful, json array\u003cbr/\u003e401 when unauthorized\u003cbr/\u003e403 when secret doesn't match\u003cbr/\u003e500 for other errors |\n| `GET /beta/:id` | 200 when successful, json object\u003cbr/\u003e401 when unauthorized\u003cbr/\u003e403 when secret doesn't match\u003cbr/\u003e404 if id could not be found\u003cbr/\u003e500 for other errors |\n| `DELETE /beta/:id` | 204 when successful deleted\u003cbr/\u003e401 when unauthorized\u003cbr/\u003e403 when secret doesn't match\u003cbr/\u003e404 if id could not be found\u003cbr/\u003e500 for other errors |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristoph-jerolimov%2Fbeta-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristoph-jerolimov%2Fbeta-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristoph-jerolimov%2Fbeta-middleware/lists"}