I am working on a project that requires a gsm Module (sim900d) send two location coordinates (current location and destination) to a server and get the direction using google maps api in response.
I started out with JavaScript and php and latter realized that JavaScript is client side and php is server side and that I can't send a javascript variable to php. I now know that I'll have to use node.js for my project. I have a little experience with JavaScript but my node.js knowledge is limited to hello world web server.
I've tried running directions-test.js for node-googlemaps unsuccessfully.
The exact code was giving an error "cannot find module '../lib/googlemaps'" so i replaced the "'../lib/googlemaps'" with 'googlemaps', it runs fine but all i get is sqrt(OK) >> 2 honored (0.896s).
I know I have to insert my google maps api key somewhere but can't figure out where and the syntax. And can someone please tell me where the directions object would be?
Edit: I am an electrical engineering student, please be elaborate in your answers. My project is EE related, I cannot learn everything and write code from scratch (due to time constraints) so related example codes would be much appreciated.
Edit 2: I have just realized that directions-test.js for node-googlemaps is not an example code, rather its Test code using vows. Vows as its website defines it is was built from the ground up to test asynchronous code. It executes your tests in parallel when it makes sense, and sequentially when there are dependencies.
See Question&Answers more detail:os