Code Monkey home page Code Monkey logo

train-journey-simulator's Introduction

Train Journey Simulation

Challenge

Implement a client-server solution to simulate a train journey based on a NMEA (gps) file attached;

The server should provide a command-line interface with at least three options: the input of NMEA file to replay, the replay speed factor (e.g. 2x, 3x, 10x), and an optional delay (e.g. 10s) to start replaying the given NMEA file. After initialization, the server should accept clients' connections at any time. The server is responsible to notify connected clients about the train's current geolocation.

The web client should, at least, display the journey path and the train's current geolocation over a map.

How to setup for development

  • Clone this repository into your projects folder.
  • cd into server and run npm install
  • cd into client and run npm install

How to run client and server (In the project root folder)

Client:

  • npm run dev:client

Server:

  • npm run dev:server <filePath> <speed> <delay : OPTIONAL> (Default is 10 seconds).
  • npm run test to run jest test suites.

Example: npm run dev:server src/nmeaFiles/leixoes_campanha.txt 2 20

Otherwise just cd into each, client or server, and user just npm run dev.

alt text

Environment Variables

I left a .env.example file in server and client, if you perhaps want to change the PORT or the app url or the server url. Just rename it to .env, change the variables and you are good to go.

Do the same for prod.env

How-to Deploy

Staging Environment

  1. Create a Virtual Machine (required VirtualBox and Vagrant to be installed)

    cd infra; vagrant up
    
  2. Provision the Virtual Machine (may require local sudo password)

    ansible-playbook -i inventory playbooks/main.yaml -K
    

train-journey-simulator's People

Contributors

julioaraujo96 avatar

Watchers

 avatar

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.