{"id":27168328,"url":"https://github.com/seo4ajax/connect-s4a","last_synced_at":"2025-04-09T05:30:05.912Z","repository":{"id":12214373,"uuid":"14821327","full_name":"seo4ajax/connect-s4a","owner":"seo4ajax","description":"Connect-s4a is a middleware for Connect framework. It provides a easy way to proxy GET requests from non-js clients to SEO4Ajax.","archived":false,"fork":false,"pushed_at":"2023-07-04T14:48:44.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T22:21:06.606Z","etag":null,"topics":["ajax","middleware","module","nodejs","prerendering","seo","seo4ajax","single-page-applications","snapshot"],"latest_commit_sha":null,"homepage":"","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/seo4ajax.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":"2013-11-30T13:24:50.000Z","updated_at":"2023-07-07T13:21:19.000Z","dependencies_parsed_at":"2023-01-13T16:50:07.717Z","dependency_job_id":null,"html_url":"https://github.com/seo4ajax/connect-s4a","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/seo4ajax%2Fconnect-s4a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seo4ajax%2Fconnect-s4a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seo4ajax%2Fconnect-s4a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seo4ajax%2Fconnect-s4a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seo4ajax","download_url":"https://codeload.github.com/seo4ajax/connect-s4a/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247986061,"owners_count":21028812,"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":["ajax","middleware","module","nodejs","prerendering","seo","seo4ajax","single-page-applications","snapshot"],"created_at":"2025-04-09T05:30:05.106Z","updated_at":"2025-04-09T05:30:05.896Z","avatar_url":"https://github.com/seo4ajax.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Connect-s4a\n\n[SEO4Ajax](https://www.seo4ajax.com) is a service that allows AJAX websites\n(e.g. based on Angular, React, Vue.js, Svelte, Backbone, Ember, jQuery etc.) to\nbe indexable by search engines and social networks.\n\nConnect-s4a is a middleware for the framework\n[Connect](https://github.com/senchalabs/connect). It provides an easy way to\nproxy bot requests to [SEO4Ajax](https://www.seo4ajax.com) in\n[Node.js](https://nodejs.org/) applications.\n\n## Usage\n\nThe middleware must be imported before connect or express.\n\nWith connect :\n\n    var connect_s4a = require('connect-s4a');\n    var token = \"your site token on SEO4Ajax\";\n    var connect = require('connect');\n    var app = connect();\n    app.use(connect_s4a(token));\n    app.use(function(req, res){\n        res.end('hello world\\n');\n    });\n    app.listen(3000);\n\nWith express 3.x:\n\n    var connect_s4a = require('connect-s4a');\n    var token = \"your site token on SEO4Ajax\";\n    var express = require('express');\n    var app = express.createServer();\n    app.use(connect_s4a(token));\n    app.get('/', function(req, res){\n        res.send('hello world');\n    });\n    app.listen(3000);\n\nWith express 4.x:\n\n    var connect_s4a = require('connect-s4a');\n    var token = \"your site token on SEO4Ajax\";\n    var express = require('express');\n    var app = express();\n    app.use(connect_s4a(token));\n    app.get('/', function(req, res){\n        res.send('hello world');\n    });\n    app.listen(3000);\n\nWith Meteor:\n\n    import { WebApp } from 'meteor/webapp';\n    import connect_s4a from 'connect-s4a';\n\n    const token = \"your site token on SEO4Ajax\";\n\n    Meteor.startup(() =\u003e {\n        WebApp.connectHandlers.use(connect_s4a(token));    \n    });\n\nThe `connect_s4a` function requires one mandatory parameter: the token of the\nsite on SEO4Ajax. The second parameter is optional, it is an object with the\nfollowing property:\n\n- `apiEndPoint`: URL to the API of SEO4Ajax (`\"http://api.seo4ajax.com/\"` by\n  default)\n- `rootPath`: a path added after the token when calling the API of SEO4Ajax\n  (`\"\"` by default)\n- `includeUserAgents`: a regular expression used to test the user-agent value of\n  bots\n  (`/(bot|spider|pinterest|crawler|archiver|flipboard|mediapartners|facebookexternalhit|quora|whatsapp|outbrain|yahoo! slurp|embedly|developers.google.com\\/+\\/web/snippet|vkshare|w3c_validator|tumblr|skypeuripreview|nuzzel|qwantify|bitrix link preview|XING-contenttabreceiver|Chrome-Lighthouse|mail\\.ru)/gi`\n  by default),\n- `ignoreUserAgents`: a regular expression used to ignore the user-agent value\n  of bots\n- `pathPattern`: a regular expression indicating the paths that must be proxied\n  to SEO4Ajax (`undefined` by default)\n\n## Installation\n\nVia npm :\n\n    $ npm install connect-s4a\n\n## How it works\n\nThis module checks the presence of a user-agent string identifying bots. If a\nbot is detected, the module requests the snapshot from api.seo4ajax.com and\nreturns it. Otherwise the module ignores the request.\n\n## Requirements\n\n- node (\u003e= 0.10.0)\n- connect (\u003e= 0.2.4) or express (\u003e= 0.3.0)\n\n## Tests\n\n    node tests/run.js\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2013-2022 Capsule Code\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the 'Software'), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseo4ajax%2Fconnect-s4a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseo4ajax%2Fconnect-s4a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseo4ajax%2Fconnect-s4a/lists"}