{"id":17825449,"url":"https://github.com/soapdog/nodejs-rust-sample-module","last_synced_at":"2025-03-18T18:32:35.948Z","repository":{"id":146157955,"uuid":"111024556","full_name":"soapdog/nodejs-rust-sample-module","owner":"soapdog","description":"A sample node module built with Rust. Calculates the closest airport to a given latlon coordinate.","archived":false,"fork":false,"pushed_at":"2017-11-23T22:39:49.000Z","size":3572,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-15T03:28:45.403Z","etag":null,"topics":["neon-bindings","nodejs","rust","sample-code"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/soapdog.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}},"created_at":"2017-11-16T21:30:30.000Z","updated_at":"2022-02-04T08:23:46.000Z","dependencies_parsed_at":"2023-03-30T08:22:47.226Z","dependency_job_id":null,"html_url":"https://github.com/soapdog/nodejs-rust-sample-module","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/soapdog%2Fnodejs-rust-sample-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapdog%2Fnodejs-rust-sample-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapdog%2Fnodejs-rust-sample-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soapdog%2Fnodejs-rust-sample-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soapdog","download_url":"https://codeload.github.com/soapdog/nodejs-rust-sample-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878682,"owners_count":20362471,"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":["neon-bindings","nodejs","rust","sample-code"],"created_at":"2024-10-27T18:13:54.326Z","updated_at":"2025-03-18T18:32:35.925Z","avatar_url":"https://github.com/soapdog.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Find Airports Close to You Webapp\r\nThis is a sample webapp to demonstrate the usage of [Rust 🦀](https://rust-lang.org)-based modules with [NodeJS](https://nodejs.org) webapps.\r\n\r\n# How the algorithm works\r\nThere is a [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) file containing about 46.000 airports. For each record we have a lot of data, including its Latitude and Longitude.\r\n\r\nOur algorithm is quite naive and there is a lot of room for improvements. Basically, we parse the CSV file into a large array of objects and then iterate over this array doing some math to calculate the [Harversine distance](https://en.wikipedia.org/wiki/Haversine_formula) between your location and the airport, if it is below 30km then that airport is included in the results.\r\n\r\nThere is no parallelism involved even though it would speedup the code a lot. \r\n\r\n\u003e REMARK: Of course there are tons of ways of solving this, going from having it all in an Oracle database with some functions in PL/SQL to calculate everthing with a simple SELECT to having a ton of microservices or serverless lambda functions figuring this out using some third-party API you have no control of. **The main objective of this sample, is to show how easy it is to build Rust-based NodeJS modules by presenting an useful and rich sample.**\r\n\r\n# How to setup\r\n\r\nYou need both NodeJS and Rust installed for this to work. You also need [Neon Bindings](https://guides.neon-bindings.com/) to be able to compile the Rust code. \r\n\r\nUse:\r\n\r\n```\r\n$ npm install\r\n```\r\n\r\nTo install all the required NodeJS modules. To build the Rust-based module using Neon Bindings:\r\n\r\n```\r\n$ neon build\r\n```\r\n\r\nRun the application with:\r\n\r\n```\r\n$ node index.js\r\n```\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoapdog%2Fnodejs-rust-sample-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoapdog%2Fnodejs-rust-sample-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoapdog%2Fnodejs-rust-sample-module/lists"}