{"id":16889685,"url":"https://github.com/benoitc/couchapp-ng","last_synced_at":"2025-04-11T13:08:02.066Z","repository":{"id":66247122,"uuid":"1267742","full_name":"benoitc/couchapp-ng","owner":"benoitc","description":"Couchapp Engine","archived":false,"fork":false,"pushed_at":"2011-01-21T10:14:08.000Z","size":834,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T10:07:20.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitc.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2011-01-18T16:59:46.000Z","updated_at":"2020-01-21T11:12:07.000Z","dependencies_parsed_at":"2023-02-20T00:45:23.038Z","dependency_job_id":null,"html_url":"https://github.com/benoitc/couchapp-ng","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchapp-ng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchapp-ng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchapp-ng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitc%2Fcouchapp-ng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitc","download_url":"https://codeload.github.com/benoitc/couchapp-ng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248404598,"owners_count":21097780,"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-13T16:58:22.027Z","updated_at":"2025-04-11T13:08:02.044Z","avatar_url":"https://github.com/benoitc.png","language":"Erlang","readme":"About\n-----\n\ncouchapp_ng is a a new CouchApp engine for CouchDB.\n\nInstall\n-------\n\nMake sure Couchdb is installed on folder above the couchapp_engine one. You\ncan also change the path of couchdb installation by passing the path to\n**COUCHDB_SRC* environment variable..\n\n::\n\n    $ make\n\n(note during development you can use *make dev* command).\n\n\nAdd couch_ng_server server to couch configuration file *local_dev.ini*\n(or in production local.ini) and edit the following section::\n\n    [daemons]\n    couchapp_ng_routes={couchapp_ng_routes, start_link, []}\n\n    [httpd_design_handlers]\n    _app = {couchapp_ng_httpd, handle_app_req}\n\n    [couchapp_ng_handlers]\n    rewrite = {couchapp_ng_handlers, rewrite_handler}\n    proxy = {couchapp_ng_handlers, proxy_handler}\n\n\nStart couchdb::\n\n    $ export $COUCHAPP_LEGACY=/path/to/couchapp_ng\n    $ ERL_FLAGS=\"-pa $COUCHAPP_LEGACY/ebin\" ./utils/run\n    \n\nNow you can test the couchapp_ng rewriter. First install `couchapp\n\u003chttp://github.com/couchapp/couchapp\u003e`_ then go in the\nexamples/legacyapp folder and do::\n\n    $ couchapp push testdb\n\nThis app for now allows you to test the rewriter. Rewrites rules are put\nin the routes property of your design documen::\n\n    [\n        {\n            \"from\": \"^/blog/(?\u003cpost_no\u003e\\\\w*)$\",\n            \"to\": \"/_show/post/(?\u003cpost_no\u003e)\"\n        },\n        {    \n            \"from\": \"^/about$\", \n            \"to\": \"about.html\",\n            \"type\": \"attachments\"\n        },\n        {\n            \"from\": \"/page/:page\",\n            \"to\": \"/_show/post/:page\",\n            \"options\": {\n                \"patterns\": {\n                    \"page\": \"\\\\w*\"\n                }\n            }\n        },\n        {\n            \"from\": \"/(?\u003cfunc\u003e\\\\w*)-(?\u003cname\u003e\\\\w*)/(?\u003cpost_no\u003e\\\\w*)$\",\n            \"to\": \"/_(?\u003cfunc\u003e)/(?\u003cname\u003e)/(?\u003cpost_no\u003e)\"\n            \n        },\n        {\n            \"from\": \"^/$\",\n            \"to\": \"index.html\"\n        },\n        {\n            \"from\": \"^/blah\",\n            \"to\": \"index.html\"\n        },\n        {\n            \"from\": \"^/index.html$\"\n        }\n    ]\n\nThe couchapp_ng rewriter allows you to pass any regexp to your rule\nor use the reversed dispatching currently use in default CouchDB\nrewriter.\n\nFor example go on http://127.0.0.1:5984/testdb/_design/legacyapp/_app/\nurl. You will see the welcome page. This correspond to the rule::\n\n    {\n        \"from\": \"^/$\",\n        \"to\": \"index.html\"\n    }\n\nYou can also do such rule::\n\n    {\n            \"from\": \"^/blog/(?\u003cpost_no\u003e\\\\w*)$\",\n            \"to\": \"/_show/post/(?\u003cpost_no\u003e)\"\n    }\n\nGo on http://127.0.0.1:5984/testdb/_design/legacyapp/_app/blog/test for\nexample to see the result. \n\nOr more complex rule:\n\n    {\n        \"from\": \"/(?\u003cfunc\u003e\\\\w*)-(?\u003cname\u003e\\\\w*)/(?\u003cpost_no\u003e\\\\w*)$\",\n        \"to\": \"/_(?\u003cfunc\u003e)/(?\u003cname\u003e)/(?\u003cpost_no\u003e)\"\n    }\n\nUrl http://127.0.0.1:5984/testdb/_design/legacyapp/_app/show-post/test \n\nis rewritten to \n\nhttp://127.0.0.1:5984/testdb/_design/legacyapp/_show/post/test\n\nReverse url dispatching is working too::\n\n    {\n        \"from\": \"/page/:page\",\n        \"to\": \"/_show/post/:page\",\n        \"options\": {\n            \"patterns\": {\n                \"page\": \"\\\\w*\"\n            }\n        }\n    }\n\nUrl http://127.0.0.1:5984/testdb/_design/legacyapp/_app/page/test \n\nis rewritten to \n\nhttp://127.0.0.1:5984/testdb/_design/legacyapp/_app/_show/post/test\n\nNote that you need to fix patterns here to have reverse dispatching\nworking, which is a litte different from default couchapp engine.\n\n\nMore doc soon.\n\nTODO:\n-----\n\n- Add Query paramenter in subtitutions variables \n- Replace shows/updates/lists by improved code.\n\n\nChangelog:\n---------\n\nversion 0.01:\n+++++++++++++\n\n - New Couchapp Rewriter\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchapp-ng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitc%2Fcouchapp-ng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitc%2Fcouchapp-ng/lists"}