{"id":22695664,"url":"https://github.com/tina4stack/tina4-js","last_synced_at":"2025-03-29T18:09:42.966Z","repository":{"id":53443465,"uuid":"471274868","full_name":"tina4stack/tina4-js","owner":"tina4stack","description":"Tina4 Library for Javascript","archived":false,"fork":false,"pushed_at":"2023-06-15T20:36:08.000Z","size":377,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T18:50:49.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/tina4stack.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-18T07:32:07.000Z","updated_at":"2023-06-10T04:40:07.000Z","dependencies_parsed_at":"2024-12-10T04:21:42.220Z","dependency_job_id":null,"html_url":"https://github.com/tina4stack/tina4-js","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/tina4stack%2Ftina4-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tina4stack","download_url":"https://codeload.github.com/tina4stack/tina4-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223319,"owners_count":20743165,"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-12-10T04:11:27.979Z","updated_at":"2025-03-29T18:09:42.945Z","avatar_url":"https://github.com/tina4stack.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tina4js - This is not another Framework for Javascript #\n\nBegin your Tina4 journey by following these steps\n\n#### Install Parcel\nParcel is a great tool to use whilst developing your project, not only does it allow you to use type script but it will bundle your project into a dist folder automatically.\n```\nnpm install --save-dev parcel\n```\n\n#### Installing Tina4js\nWe've tried to make installing Tina4js as easy as possible, this should result in a working project.\n```\nnpm install tina4js\nnpm install -g tina4js\ntina4 install\n```\n\n#### Running your project\n```\nnpm run start\n```\n\n#### Examples of routes\n\n```ts\nimport {Get} from \"tina4js/tina4/Get\";\nimport {Tina4} from \"tina4js/tina4/Tina4\";\n\n(new Get()).add('/test/hello', function (response, request) {\n    let content = `\u003ch1\u003eHello World Again!\u003c/h1\u003e`;\n    return response(content, 200, 'text/html')\n});\n\n(new Get()).add('/test', function (response, request) {\n    Tina4.renderTemplate(`\u003ch1\u003eHello {{name}}!\u003c/h1\u003e\u003cform target=\"root\" method=\"post\"\u003e\u003cinput type=\"text\" name=\"firstName\" value=\"{{firstName}}\"\u003e\u003cbutton\u003eSend\u003c/button\u003e\u003c/form\u003e`, {\n            name: \"Tina4\",\n            firstName: \"Tina4\"\n        }, function (html) {\n            return response(html, 200, 'text/html')\n        }\n    );\n});\n\n(new Get()).add('/test/{id}', function (response, request) {\n    Tina4.renderTemplate(`\u003ch1\u003eHello parsing params ok {{id}}!\u003c/h1\u003e`, request, function(html) {\n       return response(html, 200, 'text/html');\n    });\n});\n\n(new Get()).add('/', function (response, request) {\n    Tina4.renderTemplate(`index.twig`, {test: \"Hello World!\", title: \"Index Page\"}, function(html) {\n        return response (html, 200, 'text/html');\n    });\n});\n\n```\n\n#### Post Routes\nThis is configured using the tina4-api tag in the index.html file\n```ts\nimport {Post} from \"tina4js/tina4/Post\";\nimport {Api} from \"tina4js/tina4/Api\";\nimport {Tina4} from \"tina4js/tina4/Tina4\";\n\n(new Post()).add(\"/test\", function (response, request) {\n    //Send and API request\n    console.log('POST WORKING', request);\n    Api.sendRequest('',  request, 'GET', function(result) {\n        Tina4.renderTemplate(`contact.twig`, result, function(html){\n            return response(html, 200);\n        });\n    });\n});\n```\n\n### Examples of templates\n\nbase.twig\n```twig base.twig\n\u003cdiv\u003e\n    \u003cnav\u003e\n        \u003ch1\u003eHello World Hello\u003c/h1\u003e\n        \u003ca href=\"#\" onclick=\"navigate('/')\"\u003eHome\u003c/a\u003e\n        \u003ca href=\"#\" onclick=\"navigate('/test/hello')\"\u003eTest\u003c/a\u003e\n        \u003ca href=\"#\" onclick=\"navigate('/test/Hello')\"\u003eHello\u003c/a\u003e\n        \u003ca href=\"#\" onclick=\"navigate('/test')\"\u003eHello\u003c/a\u003e\n    \u003c/nav\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n    {% block content %}\n        Here is content\n    {% endblock %}\n\u003c/div\u003e\n```\n\nindex.twig\n```twig index.twig \n{% extends \"base.twig\" %}\n{% block content %}\n    {{ test }}\n{% endblock %}\n```\n\ncontact.twig - tied to the POST route above\n```twig contact.twig\n\u003ch1\u003eAPI Results\u003c/h1\u003e\n{% for result in results %}\n    {{result.name.first}}\n    \u003cimg src=\"{{result.picture.large}}\"\u003e\n{% endfor %}\n```\n\n#### Running\n\n```\nnpm start\n```\n\nComponents\n\n| Component | Example                                                       |\n|-----------|---------------------------------------------------------------|\n| tina4-api | ```\u003ctina4-api url=\"https://randomuser.me/api/\" token=\"\" /\u003e``` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftina4stack%2Ftina4-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-js/lists"}