{"id":16218452,"url":"https://github.com/yodalightsabr/function-apis","last_synced_at":"2026-04-24T16:06:43.104Z","repository":{"id":57242941,"uuid":"466590347","full_name":"YodaLightsabr/function-apis","owner":"YodaLightsabr","description":"Stop exposing APIs that are only used once; start exposing functions that seamlessly work between your server and your client","archived":false,"fork":false,"pushed_at":"2022-03-06T04:16:51.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-27T11:15:28.062Z","etag":null,"topics":["apis","fullstack-javascript","javascript","nodejs"],"latest_commit_sha":null,"homepage":"https://github.com/yodalightsabr/function-apis","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/YodaLightsabr.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":"2022-03-05T23:25:55.000Z","updated_at":"2022-03-06T07:42:07.000Z","dependencies_parsed_at":"2022-09-15T00:50:43.008Z","dependency_job_id":null,"html_url":"https://github.com/YodaLightsabr/function-apis","commit_stats":null,"previous_names":["yodalightsabr/functions.js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/YodaLightsabr/function-apis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodaLightsabr%2Ffunction-apis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodaLightsabr%2Ffunction-apis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodaLightsabr%2Ffunction-apis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodaLightsabr%2Ffunction-apis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YodaLightsabr","download_url":"https://codeload.github.com/YodaLightsabr/function-apis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YodaLightsabr%2Ffunction-apis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["apis","fullstack-javascript","javascript","nodejs"],"created_at":"2024-10-10T11:49:31.199Z","updated_at":"2026-04-24T16:06:43.090Z","avatar_url":"https://github.com/YodaLightsabr.png","language":"JavaScript","readme":"# function-apis\nPass functions to the client instead of API routes\n--------------------\nAPI routes are great for APIs, but for small projects where you have to access server data or hide application logic, you can just call a server function from the client.\n\n## Examples\n```js\n// Hide server logic\n\n// Server\nconst functions = require('function-apis');\napp.use(functions({\n    hello: (name) =\u003e {\n        return `Hello, ${name}!`;\n    }\n}, true));\n\n// Client\nhello('World').then(alert); // =\u003e 'Hello, World!'\n```\n\n```js\n// Log something to the console\n\n// Server\nconst functions = require('function-apis');\napp.use(functions({\n    consoleLog: (...data) =\u003e {\n        console.log(...data);\n        return 'OK';\n    }\n}, true));\n\n// Client\nconsoleLog('Hello!') // =\u003e 'OK'\n```\n\n## Documentation\n### `functions(functions, defineGlobally)`\nUse as express middleware. Default export.\n\n    * `functions`: Object of functions to expose to the client.\n    * `defineGlobally?`: Whether or not to define the functions globally. Defaults to `false`.\n\n`?` Optional\n\n### window.functions\nAn object of client-side functions. Available after including the following in your HTML. If `defineGlobally` is set to `true`, the functions will be available to `window[function]` in addition to `window.functions[function]`.\n```html\n\u003cscript src=\"/functions_/functions.js\"\u003e\u003c/script\u003e\n```\n\n[yodacode.xyz](https://yodacode.xyz)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodalightsabr%2Ffunction-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyodalightsabr%2Ffunction-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodalightsabr%2Ffunction-apis/lists"}