├── Procfile.txt ├── .gitignore ├── deploy.sh ├── manifest.yml ├── index.js ├── README.md ├── .editorconfig ├── lib └── routes.js ├── entry.js └── package.json /Procfile.txt: -------------------------------------------------------------------------------- 1 | web: node index.js 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | .idea 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # figure out the hosting environment 3 | -------------------------------------------------------------------------------- /manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: cite 4 | - memory: 512M 5 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require("babel-register"); 2 | require("babel-polyfill"); 3 | 4 | require('./entry'); 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Navigation for the blind 2 | 3 | ## Project at https://www.collaborizm.com/project/ByP-RLfF 4 | 5 | After pull run 6 | > npm i 7 | 8 | Install nodemon 9 | > npm i nodemon -g 10 | 11 | To start server run 12 | > npm start 13 | 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /lib/routes.js: -------------------------------------------------------------------------------- 1 | console.log('routesss'); 2 | app.get('/poi', function (req, res) { 3 | (async()=> { 4 | try { 5 | 6 | const {lat, lon} = req.query; 7 | 8 | 9 | console.log('Reverse geocoding ', lat, lon); 10 | // todo for a given point return whats around 11 | const geoResp = await geocoder.reverse({lat, lon}); 12 | 13 | if (geoResp.length > 0) { 14 | const {streetNumber, streetName} = geoResp[0]; 15 | 16 | const say = `You are at ${streetName}, ${streetName}`; 17 | 18 | res.send({say, data: geoResp[0]}); 19 | } 20 | else { 21 | // send error 22 | res.status(500).send({error: 'No results'}); 23 | } 24 | 25 | } 26 | catch (err) { 27 | console.log(err); 28 | res.status(500).send({error: 'No results'}); 29 | } 30 | })(); 31 | 32 | 33 | }); 34 | -------------------------------------------------------------------------------- /entry.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import bodyParser from 'body-parser'; 3 | import http from 'http'; 4 | import path from 'path'; 5 | import NodeGeocoder from 'node-geocoder'; 6 | 7 | 8 | 9 | global.app = express(); 10 | 11 | global.geocoder = NodeGeocoder({ 12 | provider: 'google', 13 | httpAdapter: 'https', // Default 14 | apiKey: 'AIzaSyBAKY4lG_NDhSbAgV1ibLGeJvRpO6ZuW6I', 15 | formatter: null // 'gpx', 'string', ... 16 | }); 17 | 18 | 19 | app.use(bodyParser.urlencoded({ 20 | extended: true 21 | })); 22 | 23 | 24 | function logErrors(err, req, res, next) { 25 | next(err); 26 | } 27 | app.use(logErrors); 28 | 29 | app.use(function (req, res, next) { 30 | try { 31 | res.header("Access-Control-Allow-Origin", "*"); 32 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); 33 | next(); 34 | } 35 | catch (err) { 36 | console.error(err); 37 | } 38 | }); 39 | 40 | require('./lib/routes'); 41 | 42 | app.listen(process.env.PORT || 3006, function () { 43 | console.log('LISTENTING ON ', process.env.PORT || 3006); 44 | }); 45 | 46 | 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nav-for-blind-server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "nodemon index" 9 | }, 10 | "author": "Team [https://www.collaborizm.com/project/ByP-RLfF]", 11 | "license": "ISC", 12 | "dependencies": { 13 | "babel-polyfill": "^6.9.1", 14 | "babel-register": "^6.9.0", 15 | "body-parser": "^1.15.2", 16 | "express": "^4.14.0", 17 | "node-geocoder": "^3.13.1" 18 | }, 19 | "devDependencies": { 20 | "babel-cli": "^6.10.1", 21 | "babel-core": "^6.9.1", 22 | "babel-plugin-add-module-exports": "^0.2.1", 23 | "babel-plugin-react-transform": "^2.0.0", 24 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 25 | "babel-plugin-transform-react-display-name": "^6.8.0", 26 | "babel-plugin-transform-runtime": "^6.9.0", 27 | "babel-polyfill": "^6.9.1", 28 | "babel-preset-es2015": "^6.9.0", 29 | "babel-preset-react": "^6.3.13", 30 | "babel-preset-stage-0": "^6.3.13", 31 | "babel-preset-stage-1": "^6.3.13", 32 | "babel-preset-stage-2": "^6.3.13", 33 | "babel-preset-stage-3": "^6.3.13", 34 | "babel-register": "^6.9.0", 35 | "babel-runtime": "^6.9.2" 36 | }, 37 | "babel": { 38 | "presets": [ 39 | "es2015", 40 | "stage-0", 41 | "stage-1", 42 | "stage-2", 43 | "stage-3" 44 | ] 45 | } 46 | } 47 | --------------------------------------------------------------------------------