Giter VIP home page Giter VIP logo

nodejs-rust-sample-module's Introduction

Find Airports Close to You Webapp

This is a sample webapp to demonstrate the usage of Rust ๐Ÿฆ€-based modules with NodeJS webapps.

How the algorithm works

There is a CSV file containing about 46.000 airports. For each record we have a lot of data, including its Latitude and Longitude.

Our 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 between your location and the airport, if it is below 30km then that airport is included in the results.

There is no parallelism involved even though it would speedup the code a lot.

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.

How to setup

You need both NodeJS and Rust installed for this to work. You also need Neon Bindings to be able to compile the Rust code.

Use:

$ npm install

To install all the required NodeJS modules. To build the Rust-based module using Neon Bindings:

$ neon build

Run the application with:

$ node index.js

nodejs-rust-sample-module's People

Contributors

soapdog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ch3ll0v3k

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.