Execute startDB.sh
, build.sh
and run.sh
.
You will need a .env
file with the following envars:
SECRET=
MONGO_HOST=
MONGO_PORT=
MONGO_INITDB_ROOT_USERNAME=
MONGO_INITDB_ROOT_PASSWORD=
Can be called via form data or JSON body. The mandatory format has to be the following:
{
"email": "biene@hackupc.com",
"password": "biene"
}
After that, you can add all the key, value pairs you want. They will be stored in the meta object of the user created.
A JWT token.
HTTP 200
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVkYTI4OTk0NmNkMWNhM2E5MDg4ZDg1NSJ9.ohkLJrptxT0F4wuQekOQEK-qpxNHnrA-jVTwZ4psx74"
}
Can be called via form data or JSON body. The format has to be the following:
{
"email": "biene@hackupc.com",
"password": "biene"
}
A JWT token.
HTTP 200
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVkYTI4OTk0NmNkMWNhM2E5MDg4ZDg1NSJ9.ohkLJrptxT0F4wuQekOQEK-qpxNHnrA-jVTwZ4psx74"
}
You should delete the auth header before calling this.
HTTP 200
{
"message": "logged out"
}
The token as a Authorization: Bearer {token}
header.
Returns JSON
HTTP 200
{
"data": [
{
"id": "5da25e5286dc7e9c3be99a0d",
"data": {
"lang": "C",
"desccription": "I like maths!",
"age": 22
}
},
{
"id": "5da25e5286dc7e9c3be99a0d",
"data": {
"lang": "Python",
"dick": 25
}
}
]
}
The token as a Authorization: Bearer {token}
header.
Can be called via form data or JSON body. The format has to be the following:
{
"id_a": "5da25e5286dc7e9c3be99a0d",
"id_b": "5da26d9687f808f820d54233",
"win": false
}
The parameters mean:
id_a
: User A id.id_b
: User B id.win
: True if the selected is id_a, False if it's id_b.
HTTP 200
{
"message": "user relations updated"
}
The token as a Authorization: Bearer {token}
header.
Returns JSON with an array (actual max 5 elements, may be changed xd).
HTTP 200
{
"data": [
{
"id": "5da26d9687f808f820d54233",
"elo": 1546.0200225109015,
"user_data": {
"email": "jajaasd",
"meta": {
"lang": "Python 3.7",
"description": "hola asd k tal"
}
}
},
{
"id": "5da23afa05650a08e4ca6a8f",
"elo": 1534.137483083232,
"user_data": {
"email": "2pac",
"meta": {
"lang": "OCaml",
"description": "jeje"
}
}
},
{
"id": "5da25e5286dc7e9c3be99a0d",
"elo": 1516.983271764316,
"user_data": {
"email": "taras",
"meta": {
"lang": "C",
"desccription": "asdasd asdas"
}
}
},
{
"id": "5da25857e57c8c0839a12bea",
"elo": 1465.0496502835474,
"user_data": {
"email": "asd",
"meta": {
"lang": "R",
"description": "juju"
}
}
},
{
"id": "5da25e8e5dd47b259e2ac2e3",
"elo": 1434.9030321116102,
"user_data": {
"email": "taras",
"meta": {
"lang": "C",
"desccription": "asdasd asdas"
}
}
}
]
}
The token as a Authorization: Bearer {token}
header.
Binary data with optional Content-Type
header.
Adds a document to the media
collection with user_id
the given user.
Now it adds raw binary data to the db, in the next pivot (v1337.0.0) this will be changed to a url of the image in some cloud platform (Google Cloud probably).
Returns JSON
HTTP 200
{
"message": "media content uploaded"
}
The token as a Authorization: Bearer {token}
header.
Returns JSON
HTTP 200
{
"user": {
"id": "5da48689bac312608d6d23fc",
"meta": {
"description": ":3",
"lang": "Python 2.7",
"position": "CEO",
"age": 22,
"orientation": "all",
"whatever": "love you bb"
}
},
"media": [
{
"id": "5da493415a0927043cc640f9",
"data": {
"$binary": "iVB...rkJggg==",
"$type": "00"
},
"type": "image/png"
}
]
}