Experimental NodeJS Location Data Server 8.0.1 with CGI GET query and JSON results

Ole Aamot ole at aamotsoftware.no
Mon Sep 11 16:59:07 CEST 2023


Hei,

Jeg har bygd min første NodeJS pakke og publisert denne på
https://www.npmjs.com/package/location-server/

$ git clone https://gitlab.com/ole.aamot/location-server
$ npm install axios express
$ node location-server.cjs

> location-server at 8.0.1 start
> node location-server.cjs

Location Data Server listening on port 3000

$ curl
http://localhost:3000/location-data?service=Food&glat=60&glon=10&radius=1000
<http://localhost:3000/location-data?service=Food&glat=60&glon=10&radius=100000>
"var locations = '{ \"locations\" : [' + '{\"id\": \"11884992\", \"name\":
\"Løren\", \"service\": \"Food\", \"location\": \"https://www.loren.no/\",
\"modified\": \"2023-07-04 12:00:00\", \"created\": \"2023-07-05
12:00:00\", \"glat\": \"59.92929197\", \"glon\": \"10.79022856\", \"paid\":
\"0\", \"token\": \"tok_1NPyQRAgJ7jHvJPRPHRLaktB\", \"type\": \"card\",
\"distance\": \"44.61835617894167\", \"email\":
\"ole at aamot.software\"},{\"id\":
\"11884996\", \"name\": \"@HappyJuly4th\", \"service\": \"Food\",
\"location\": \"https://www.piperpal.com/Food/@HappyJuly4th\",
\"modified\": \"2023-07-18 12:00:00\", \"created\": \"2023-07-25
12:00:00\", \"glat\": \"59.92929074\", \"glon\": \"10.79037934\", \"paid\":
\"1\", \"token\": \"tok_1NQ1oDAgJ7jHvJPRGaiDmiKR\", \"type\": \"card\",
\"distance\": \"44.62663072803127\", \"email\": \"ole at aamotsoftware.no
\"}]}';\n"

CGI-parametrene service, glat, glon og radius er skrankene for søket som
foretas via axios.get() til responsen

const response = await
axios.get(`https://api.piperpal.com/location/json.php?service=${service}&glat=${glat}&glon=${glon}&radius=${radius}`);

Jeg skriver ut responsen med res.json().

Responsen er

"var locations = '{ \"locations\" : [' + '{\"id\": \"11884992\", \"name\":
\"Løren\", \"service\": \"Food\", \"location\": \"https://www.loren.no/\",
\"modified\": \"2023-07-04 12:00:00\", \"created\": \"2023-07-05
12:00:00\", \"glat\": \"59.92929197\", \"glon\": \"10.79022856\", \"paid\":
\"0\", \"token\": \"tok_1NPyQRAgJ7jHvJPRPHRLaktB\", \"type\": \"card\",
\"distance\": \"44.61835617894167\", \"email\":
\"ole at aamot.software\"},{\"id\":
\"11884996\", \"name\": \"@HappyJuly4th\", \"service\": \"Food\",
\"location\": \"https://www.piperpal.com/Food/@HappyJuly4th\",
\"modified\": \"2023-07-18 12:00:00\", \"created\": \"2023-07-25
12:00:00\", \"glat\": \"59.92929074\", \"glon\": \"10.79037934\", \"paid\":
\"1\", \"token\": \"tok_1NQ1oDAgJ7jHvJPRGaiDmiKR\", \"type\": \"card\",
\"distance\": \"44.62663072803127\", \"email\": \"ole at aamotsoftware.no
\"}]}';\n"

Jeg har skrevet mer om Piperpal 7.0 JSON API på
https://www.piperpal.com/mobile/

og http://www.stud.ntnu.no/~olekaam/thesis.pdf  fra 1 August 2023 (Pending
Review).

Følger PROG2053 ved NTNU i Gjøvik for veiledning rundt å skrive
applikasjoner i express i npm og NodeJS.

Bachelor-oppgaven min om lokasjonssøking som jeg skriver på og har
publisert som Piperpal Mobile på https://www.piperpal.com/mobile/ og
location-server for NodeJS er publisert på
https://www.npmjs.com/package/location-server/

Du finner kildekoden til www.piperpal.com på
https://www.github.com/piperpal/www/
<https://www.github.com/piperpal/www/>
GitHub - piperpal/www: www.piperpal.com
<https://www.github.com/piperpal/www/>
www.piperpal.com. Contribute to piperpal/www development by creating an
account on GitHub.
www.github.com
Serveren location-server for NodeJS kjører lokalt med "node
location-server.cjs" som HTTP/1.1 tjeneste og reflekterer SQL-databasen til
www.piperpal.com (Piperpal 7.0 JSON Server) som et NodeJS
package-grensesnitt.

Lokasjonssøkemotoren www.piperpal.com og databasen inneholder 11.835.708
lokasjonsoppføringer for service=Books fra wikinames.info.

Dette er en prototype av Geolokasjonsgrensesnitt for datainnsamling ved
hjelp av W3C sitt Geolocation API, HTML5, CSS, og jQuery.

En kan legge til nye oppføringer på www.geopher.com ved hjelp av VISA-kort.

Hører gjerne fra Dere!

Mvh,
Ole Aamot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nuug.no/pipermail/nikita-noark/attachments/20230911/4f523d31/attachment.htm>


More information about the nikita-noark mailing list