{"id":16935248,"url":"https://github.com/bsmth/datastreamer-node-maps","last_synced_at":"2026-01-23T11:46:55.256Z","repository":{"id":42306257,"uuid":"227389525","full_name":"bsmth/datastreamer-node-maps","owner":"bsmth","description":"EMnify DataStreamer REST API Example","archived":false,"fork":false,"pushed_at":"2024-10-03T10:58:26.000Z","size":830,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-30T03:42:12.401Z","etag":null,"topics":["demo","express","geolocation","heroku","iot","maps","node","visualization"],"latest_commit_sha":null,"homepage":"https://datastreamer-maps-example.herokuapp.com/","language":"EJS","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/bsmth.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2019-12-11T14:48:35.000Z","updated_at":"2022-08-31T07:54:49.000Z","dependencies_parsed_at":"2025-04-13T13:42:57.230Z","dependency_job_id":null,"html_url":"https://github.com/bsmth/datastreamer-node-maps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bsmth/datastreamer-node-maps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsmth%2Fdatastreamer-node-maps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsmth%2Fdatastreamer-node-maps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsmth%2Fdatastreamer-node-maps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsmth%2Fdatastreamer-node-maps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsmth","download_url":"https://codeload.github.com/bsmth/datastreamer-node-maps/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsmth%2Fdatastreamer-node-maps/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28690605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["demo","express","geolocation","heroku","iot","maps","node","visualization"],"created_at":"2024-10-13T20:54:03.394Z","updated_at":"2026-01-23T11:46:55.207Z","avatar_url":"https://github.com/bsmth.png","language":"EJS","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Datastreamer Maps Example\n\nA node.js application using a Rest API data streamer to update an embedded map with location data.\n\nimage::doc/node-maps-example.png[]\n\n*Prerequisites:*\n\n* https://nodejs.org/en/[node.js]\n* https://devcenter.heroku.com/articles/heroku-cli[Heroku CLI]\n* https://console.cloud.google.com/apis/credentials[Google Maps API Keys]\n\n== Getting Started\n\nFrom the project root, create a Heroku app and make note of the application name:\n\n[source,bash]\n----\n$ heroku create\nCreating app... done, ⬢ \u003cheroku_app_name\u003e\n----\n\nSet the Google Maps API key for geolookup and maps queries:\n\n[source,bash]\n----\n$ heroku config:set API_KEY=\u003cmy_google_maps_api_key\u003e\n----\n\nProvision a Postgres DB:\n\n[source,bash]\n----\n$ heroku addons:create heroku-postgresql:hobby-dev\n----\n\nMake a note of the DB addon name:\n\n[source,bash]\n----\n$ heroku pg:info\n----\n\nThe addon name is shown at the bottom in the format `postgresql-\u003crandom_name\u003e`:\n\n[source,bash]\n----\n...\nAdd-on:                postgresql-\u003crandom_name\u003e\n----\n\nCreate a table `coords_table` in your DB (see above for the values to replace in `\u003cpostgres_addon_name\u003e` and `\u003cheroku_app_name\u003e`):\n\n[source,bash]\n----\n$ heroku pg:psql \u003cpostgres_addon_name\u003e --app \u003cheroku_app_name\u003e\n----\n\nAt the point where you have `\u003cheroku_app_name\u003e::DATABASE=\u003e` in the terminal, create a table and set the schema for `coords_table` using the following command and type `exit` when finished:\n\n[source,sql]\n----\nCREATE TABLE coords_table (\n  ID SERIAL PRIMARY KEY,\n  timestamp timestamp,\n  endpoint_id bigint,\n  endpoint_name varchar,\n  lat numeric,\n  long numeric,\n  accuracy numeric\n);\n----\n\nDeploy to Heroku and confirm the application is running:\n\n[source,bash]\n----\n$ git push heroku master\n$ heroku logs --tail\n----\n\nA small test script is added to post dummy data toward the DB to ensure your application is set up correctly.\nEdit the `post-pdp.sh` script to have contain your application server URL and run it:\n\n[source,bash]\n----\n$ ./post-pdp.sh\n----\n\nRunning `heroku pg:info` should list one Table and at least one Row after running the `post-pdp.sh` script\n\n[source,bash]\n----\n...\nTables:                1\nRows:                  20/10000 (In compliance)\n----\n\nYour application will now show test entries on the map page:\n\nimage::doc/maps-example.png[]\n\n== Streaming Platform Data\n\n1. Navigate to the EUI https://cdn.emnify.net/eui/#/tech_settings[tech settings] page\n2. Click *+ Add Data Stream*\n3. Select *Usage Data \u0026 Events* for Data Stream Type and *RestAPI* for API Type\n4. Click the 'cog' settings button to add a new API URL\n5. Enter the app URL (e.g. `https://\u003cmy_app_url\u003e.herokuapp.com`) and click *+*\n6. Select the new URL from the list of available API URLs\n7. Click *Add Data Stream*\n\nIf the connection is working as expected, a `200` success code will be shown in the EUI for that stream when new events occur.\n\n== Development\n\nThe `DATABASE_URL` value can be found using the following command (after `Connection URL:`):\n\n[source,bash]\n----\n$ heroku pg:credentials:url\n----\n\nCreate a file named `.env` in the project root which contains the Maps API and Postgres credentials in the following format:\n\n[source,bash]\n----\nAPI_KEY=\u003cmy_google_maps_api_key\u003e\nDATABASE_URL=postgres://\u003cusername\u003e:\u003clong-password\u003e@\u003cserver_ip\u003e.eu-west-1.compute.amazonaws.com:\u003cport\u003e/\u003capp\u003e\n----\n\n\u003e The .env file should not be committed to git history as it contains your app secrets!\n\nRun locally using:\n\n[source,bash]\n----\n$ npm install\n$ node index.js\n----\n\n\u003e To permanently reset the DB, run `heroku pg:reset postgresql-\u003caddon_name\u003e --confirm \u003chroku_app_name\u003e`. This can also be done in the browser at https://dashboard.heroku.com/apps/\u003capp_name\u003e/resources\n\n\n=== Templates\n\nThe project uses the EJS templating engine. For the main application pages, the templates can be found in `./views/pages`\n\n\n=== Helper Functions\n\nThe main application logic is located in the `index.js` file. Some helper functions are added to the `helpers.js` and are exported for use elsewhere.\n\n== Resources\n\n* https://devcenter.heroku.com/articles/getting-started-with-nodejs[Getting started with Node.js on Heroku]\n* https://devcenter.heroku.com/articles/heroku-postgresql#provisioning-heroku-postgres[Deploying Postgres on Heroku]\n* https://ejs.co/[EJS Templating Reference]\n* https://developers.google.com/maps/documentation/javascript/adding-a-google-map[Google Maps Javascript Examples]\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsmth%2Fdatastreamer-node-maps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsmth%2Fdatastreamer-node-maps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsmth%2Fdatastreamer-node-maps/lists"}