{"id":21893328,"url":"https://github.com/norjs/cloud-backend","last_synced_at":"2026-05-20T14:42:39.249Z","repository":{"id":57131900,"uuid":"96580150","full_name":"norjs/cloud-backend","owner":"norjs","description":"Backend for NorJS full stack framework","archived":false,"fork":false,"pushed_at":"2019-01-07T16:02:21.000Z","size":831,"stargazers_count":1,"open_issues_count":19,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T04:35:29.009Z","etag":null,"topics":["backend","microservices","nodejs","restful"],"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/norjs.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":"2017-07-07T22:10:01.000Z","updated_at":"2020-05-03T12:12:49.000Z","dependencies_parsed_at":"2022-09-04T23:12:20.295Z","dependency_job_id":null,"html_url":"https://github.com/norjs/cloud-backend","commit_stats":null,"previous_names":["norjs/backend","sendanor/cloud-backend"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norjs%2Fcloud-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norjs%2Fcloud-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norjs%2Fcloud-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norjs%2Fcloud-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/norjs","download_url":"https://codeload.github.com/norjs/cloud-backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902921,"owners_count":20529114,"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":["backend","microservices","nodejs","restful"],"created_at":"2024-11-28T13:13:27.329Z","updated_at":"2026-05-20T14:42:38.981Z","avatar_url":"https://github.com/norjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"NorJS Backend Server\n--------------------\n\nThis is an application which runs micro services for NorJS framework.\n\nThis application is still in active development and may have few bugs in it. Please submit [issues](https://github.com/norjs/backend/issues) and we'll look into it.\n\n### Install\n\n`npm install -g @norjs/backend`\n\n### Tutorial\n\n***Note!*** This example assumes you are familiar with babel-cli and use it to convert your ES6 files. You can compile \nour examples with `npm run compile-examples`.\n\nWe'll start two different systems in this example which talk to each other. We'll run them on the same local machine, \nbut they could be anywhere in the network.\n\nFirst we'll create a test service which saves a time when `.updateDate()` is triggered.\n\n```javascript\nexport default class DateService {\n\n\tconstructor () {\n\t\tthis.date = new Date();\n\t}\n\n\tupdateDate () {\n\t\tthis.date = new Date();\n\t}\n\n\tsetTime (time) {\n\t\tthis.date = new Date();\n\t\tthis.date.setTime(time);\n\t}\n\n}\n```\n\nWith this service instance, you can see the `date` property and you can call `.updateDate()`.\n\nThen we'll create another service which uses our `DateService`:\n\n```javascript\nexport default class TestDateService {\n\n\tconstructor (DateService) {\n\t\tthis._Date = DateService;\n\t}\n\n\tupdateDate () {\n\t\treturn this._Date.updateDate();\n\t}\n\n\tsetTime (time) {\n\t\treturn this._Date.setTime(time);\n\t}\n\n\n}\n```\n\nNote! Any property with leading `_` will be private and not shared with other systems.\n\nOur `TestDateService` can set a time, but cannot see it.\n\nNext we'll start our first daemon:\n\n```\n$ norjs-backend ./dist/examples/DateService.js --protocol=http --auth=basic:demo:'$apr1$N8FG9xe6$KRqwt39aE3UX4szXSeeZD0'\n2017-07-10T09:22:14+03:00 [main] Added credentials for auth basic for user demo\n2017-07-10T09:22:14+03:00 [ServiceCache] Registered ServiceCache with UUID 0c49ef8e-d22d-4fcb-b662-57722ccbd64b\n2017-07-10T09:22:14+03:00 [ServiceCache] Registered DateService with UUID 85ade1e9-0c42-45b6-85c5-51586cde7093\n2017-07-10T09:22:14+03:00 [main] All services started.\n2017-07-10T09:22:14+03:00 [main] All services initialized.\n2017-07-10T09:22:14+03:00 [main] Basic auth support enabled.\n2017-07-10T09:22:14+03:00 [main] Service DateService started at port 3000 as http\n```\n\n* The password for HTTP basic auth is `test` and username is `demo`.\n\nThen we'll start our other service and connect to remote `DateService`:\n\n```\n$ norjs-backend http://demo:test@localhost:3000 ./dist/examples/TestDateService.js --port=3001 --protocol=http --listen=TestDateService\n2017-07-10T09:27:16+03:00 [ServiceCache] Registered ServiceCache with UUID 5aa563b0-584c-4338-9cb1-caae6efb081f\n2017-07-10T09:27:16+03:00 [ServiceCache] No service DateService for TestDateService. Waiting 1 s.\n2017-07-10T09:27:16+03:00 [ServiceCache] Registered DateService with UUID 2922feaa-0430-42bd-a11a-9d951931d068\n2017-07-10T09:27:17+03:00 [ServiceCache] Registered TestDateService with UUID 4ae03a09-2460-4416-8555-4f21585e6093\n2017-07-10T09:27:17+03:00 [main] All services started.\n2017-07-10T09:27:17+03:00 [main] All services initialized.\n2017-07-10T09:27:17+03:00 [main] Service TestDateService started at port 3001 as http\n```\n\nNow we can access `TestDateService` as an unprotected service at `http://localhost:3001`:\n\n```\n$ curl http://localhost:3001\n{\n  \"$id\": \"5667dd0c-16bb-5761-b95b-431f2132eb06\",\n  \"$hash\": \"0d6be056bed96911d812800ec7d7c973825296e057be76d1eec9b2b0f33cf346\",\n  \"$ref\": \"http://localhost:3001/\",\n  \"$type\": \"TestDateService\",\n  \"$prototype\": {\n    \"$id\": \"b35c596f-8a0c-53d7-9d1e-dd7ca50bfec1\",\n    \"$hash\": \"1d4ed609bcf686ced0ec5082febe9d21134b2d5cf4d6451545c88640734502b7\",\n    \"$ref\": \"http://localhost:3001/\",\n    \"$name\": \"TestDateService\",\n    \"$type\": [\n      \"TestDateService\"\n    ],\n    \"updateDate\": {\n      \"$ref\": \"http://localhost:3001/updateDate\",\n      \"$type\": \"Function\",\n      \"$method\": \"post\",\n      \"$args\": [],\n      \"length\": 0,\n      \"name\": \"updateDate\"\n    }\n  }\n}\n```\n\nWe can trigger new date like this:\n\n```\n$ curl -X POST http://localhost:3001/updateDate\n{\n  \"$ref\": \"http://localhost:3001/updateDate\",\n  \"$path\": \"payload\",\n  \"$type\": \"undefined\"\n}\n```\n\nWe can also access `DateService` directly as a password protected service at `http://demo:test@localhost:3000`:\n\n```\n$ curl http://demo:test@localhost:3000\n{\n  \"$id\": \"852aa819-0167-5cac-b45d-43437f2e8277\",\n  \"$hash\": \"9301e63a3dc7f62e6779e70aed643a2c2c9e812168bd62e7d22fb194574bcd18\",\n  \"$ref\": \"http://localhost:3000/\",\n  \"$type\": \"DateService\",\n  \"date\": \"2017-07-10T06:56:17.729Z\",\n  \"$prototype\": {\n    \"$id\": \"f765f856-2da9-51cc-86da-12584a2f5dce\",\n    \"$hash\": \"86226f83510a5eadc231aeffa8ddeca25ef30e2a4cbcab1d8817e39d4940207b\",\n    \"$ref\": \"http://localhost:3000/\",\n    \"$name\": \"DateService\",\n    \"$type\": [\n      \"DateService\"\n    ],\n    \"updateDate\": {\n      \"$ref\": \"http://localhost:3000/updateDate\",\n      \"$type\": \"Function\",\n      \"$method\": \"post\",\n      \"$args\": [],\n      \"length\": 0,\n      \"name\": \"updateDate\"\n    }\n  }\n}\n```\n\n* Notice how `DateService` has a readable property `date`, but `TestDateService` does not have it.\n\nSome functions might require arguments:\n\n```\n$ curl -H \"Content-Type: application/json\" --data '{\"$args\":[1539446645624]}' -X POST http://localhost:3001/setTime\n{\n  \"$ref\": \"http://localhost:3001/updateDate\",\n  \"$path\": \"payload\",\n  \"$type\": \"undefined\"\n}\n```\n\n### Different ways of running\n\nUse as a client-verified protected HTTPS server: `norjs-backend ./TestService.js --ca-file=./ca-crt.pem --key-file=./localhost-key.pem --cert-file=./localhost-crt.pem --protocol=https`\n\nUse as an unprotected HTTP server: `norjs-backend ./TestService.js --protocol=http`\n\nUse without a server: `norjs-backend ./TestService.js`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorjs%2Fcloud-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnorjs%2Fcloud-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorjs%2Fcloud-backend/lists"}