Closed ezio-hub closed 4 years ago
The basic requirments is complete, live api doc, http://120.26.39.188:9090/apidoc/
run server
npm run dev
watch api doc
npm install apidoc -g
npm run watch_apidoc
it will generate apidoc files when your apidoc comments changes, you can go to localhost:9090/apidoc/ and test your api in realtime
the followers/following friends features, the friend can be like this
Id,userId,friendId,createdAt
get followers will query by friends.query({friendId:userId})
get following will query by friends.query({userId:userId})
The api will be
follow POST /api/v1/users/follow
get Followers Get /api/v1/users/followers
get following Get /api/v1/users/following
unfollow DELETE api/v1/users/followers/:id
geo search I will create a location field in user document like this
location: {
type: "Point",
coordinates: [-73.856077, 40.848447]
}
and update all users CRUD api. add new api GET /api/v1/users/nearby?query=link and build the query like this
db.users.find(
{
location:
{ $near :
{
$geometry: { type: "Point", coordinates: [ -73.9667, 40.78 ] },
$minDistance: 1000,
$maxDistance: 5000
}
}
}
)
test setps
http://120.26.39.188:9090/apidoc/#api-users-createUser
id is 5f1e2f194d88671d9b0c7ade
token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMWUyZjE5NGQ4ODY3MWQ5YjBjN2FkZSIsImlhdCI6MTU5NTgxMzY1NywiZXhwIjoxNTk5NDEzNjU3fQ.IT32WV21rhcx_2L6PpoMwnHqN_LIqpeMzdRIwkV_JeI
http://120.26.39.188:9090/apidoc/#api-users-partiallyUpdateUser
http://120.26.39.188:9090/apidoc/#api-users-fullyUpdateUser
get user from list by search
work in process