This app allows people to find items they need urgently (and cannot buy, as they are currently sold out) and trade for them with items they have too much of.
To setup and run a local instance execute the following commands:
$ npm install
$ cd public
$ npm install
$ cd ..
$ npm start
A simple example:
Mr. Brown freaked out, when he heard of the outbreak of a new disease. He ran to the store and bought tons of toilet paper. But in his urgency he forgot to buy noodles.
Mrs. Green meanwhile could not get any toilet paper, but bought a bunch of noodle packs. She calls up the CoronaExchange app and adds noodles to her stock, stating that she's willing to trade for toilet paper.
Mr. Brown opens up his app and can quickly check that someone close to him (Mrs. Green) is offering noodles for toilet paper. He clicks the trade offer and negotiates a meeting, where they can safely exchange a set amount of their items.
If you are wondering what amount of toilet paper usually trades for a pack of noodles, you can quickly check with a look at the current CoronaExchange Stock Market.
http://localhost:5000/api/search?topLeftLocation=52.5,13&lowerRightLocation=54,14
[
{
"user": "Wolverine",
"location": {
"lat": 52.5157723,
"lng": 13.3869281
},
"offer": "Nudeln",
"tradeFor": "Toiletten Papier"
},
{
"user": "Gandalf",
"location": {
"lat": 52.5670062,
"lng": 13.3936488
},
"offer": "Dosenwurst",
"tradeFor": "Mineralwasser"
}
]
This requires a valid authentication token from Firebase. The user id is determined from the token.
http://localhost:5000/api/chat/KhxRmzKFILT8ziEwDhPJZd65lnq1
[
{
"from": "KhxRmzKFILT8ziEwDhPJZd65lnq1",
"to": "sJoqxWyKobTJZp3LAEoZlcyccKg1",
"date": "2020-03-20T12:22:38 -00:00",
"text": "Hi Walter. Ich interessiere mich für dein Mineralwasser. Ich hätte Dosenwurst im Austausch."
},
{
"from": "sJoqxWyKobTJZp3LAEoZlcyccKg1",
"to": "KhxRmzKFILT8ziEwDhPJZd65lnq1",
"date": "2020-03-20T14:12:32 -00:00",
"text": "Gerne. Wann können wir die Waren austauschen?"
},
{
"from": "KhxRmzKFILT8ziEwDhPJZd65lnq1",
"to": "sJoqxWyKobTJZp3LAEoZlcyccKg1",
"date": "2020-03-20T14:13:23 -00:00",
"text": "In 10 min beim Kiosk an der Ecke."
},
{
"from": "sJoqxWyKobTJZp3LAEoZlcyccKg1",
"to": "KhxRmzKFILT8ziEwDhPJZd65lnq1",
"date": "2020-03-20T14:15:00 -00:00",
"text": "Ok. Bis gleich."
}
]
This requires a valid authentication token from Firebase. The user id is determined from the token.
{
"message":"Hello!"
}
If the message was posted successfully, the endpoint will return 200 OK
.
This is where we have the most frontend knowledge currently.
Node.js is easy to setup and learn. Additionally it allows frontend developers with a little Javascript knowledge to help out with backend development.
Free to use. The following is an excerpt from the Heroku example project getting-started-with-nodejs
.
A barebones Node.js app using Express 4.
This application supports the Getting Started on Heroku with Node.js article - check it out.
Make sure you have Node.js and the Heroku CLI installed.
$ git clone https://github.com/heroku/node-js-getting-started.git # or clone your own fork
$ cd node-js-getting-started
$ npm install
$ npm start
Your app should now be running on localhost:5000.
$ heroku create
$ git push heroku master
$ heroku open
or
For more information about using Node.js on Heroku, see these Dev Center articles:
- Getting Started on Heroku with Node.js
- Heroku Node.js Support
- Node.js on Heroku
- Best Practices for Node.js Development
- Using WebSockets on Heroku with Node.js
We decided to use the Google service Firebase to support social login authentication.
The offerings-berlin.json contains sample data in and around Berlin. The test data was generated with https://www.json-generator.com/# by using the following query:
[
'{{repeat(1000)}}',
{
_id: '{{objectId()}}',
userId: '{{random("4UfWXtocrIVst8ibYw1Nu2CqHQC2", "KhxRmzKFILT8ziEwDhPJZd65lnq1", "sJoqxWyKobTJZp3LAEoZlcyccKg1", "PdWOFNsvMRZRogZQdFxd2oywsAH2")}}',
location: {
lat: '{{floating(52.354002, 52.622138)}}',
lng: '{{floating(13.220354, 13.739104)}}'
},
offer: '{{random("Nudeln", "Toilettenpapier","Mineralwasser","Dosenwurst")}}',
tradeFor: '{{random("Nudeln", "Toilettenpapier","Mineralwasser","Dosenwurst")}}'
}
]
The test users are:
- wolverine@xmen.test (userId:4UfWXtocrIVst8ibYw1Nu2CqHQC2)
- gandalf@lofr.test (userId: KhxRmzKFILT8ziEwDhPJZd65lnq1)
- walter@breakingb.test (userId: sJoqxWyKobTJZp3LAEoZlcyccKg1)
- morpheus@matrix.test (userId: PdWOFNsvMRZRogZQdFxd2oywsAH2)