Sample application that uses docker, docker-compose, restify, mongodb and jest using async.
$ docker-compose up
process.env.MONGODB_URI = 'mongodb://127.0.0.1:27017/test';
$ docker-compose up mongo
or
$ yarn test
$ npm run test
Postman could be used to try the application
Below are the exposed routes of the api
{
"friends": ["test1@test.com", "test2@test.com"]
}
{
"success": true
}
GET /friends/:email
http://localhost:4000/friends/test1@test.com
{
"success": true,
"friends": [
"test2@ttest.com"
],
"count": 1
}
POST /friends/common
{
"friends": ["test1@test.com", "test2@test.com"]
}
{
"count": 1,
"friends": [
"test3@test.com",
],
"success": true
}
POST /friends/subscribe
{
"requestor": "test1@test.com",
"target": "test2@test.com"
}
{
"success": true
}
POST /friends/block
{
"requestor": "test1@test.com",
"target": "test2@test.com"
}
{
"success": true
}
{
"sender": "test1@test.com",
"text": "Hello World! test2@test.com"
}
{
"recipients": [
"test2@test.com",
"test3@test.com"
],
"success": true
}