2013-09-14 23:35:50 +02:00
|
|
|
Development notes
|
2013-09-16 21:14:54 +02:00
|
|
|
=================
|
|
|
|
|
|
|
|
Session data
|
|
|
|
------------
|
|
|
|
|
|
|
|
This is a skeleton of what the session data within node.js will look like:
|
|
|
|
|
|
|
|
req.session = {
|
|
|
|
"initialized": true,
|
|
|
|
"data": {
|
|
|
|
"user": {}, //see user document
|
|
|
|
"profile": {}, //see profile document .data attribute
|
|
|
|
"login": false,
|
|
|
|
"lastActivity": new Date().toString()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Database documents
|
2013-09-15 13:45:00 +02:00
|
|
|
------------------
|
2013-09-14 23:35:50 +02:00
|
|
|
|
|
|
|
user document:
|
|
|
|
{
|
|
|
|
"_id": "%NICKNAME%",
|
|
|
|
"auth": "%SCRYPTHASH%",
|
|
|
|
"email": "%USERMAIL%",
|
|
|
|
"type": "user",
|
|
|
|
"profile": "%COUCHDOCID_PROFILE%"
|
|
|
|
}
|
|
|
|
|
|
|
|
profile document:
|
|
|
|
{
|
|
|
|
"_id": "%COUCHDOCID%",
|
|
|
|
"type": "profile",
|
2013-09-15 13:45:00 +02:00
|
|
|
"data": {
|
|
|
|
//the object that is handled
|
|
|
|
}
|
2013-09-14 23:35:50 +02:00
|
|
|
}
|
|
|
|
|
2013-09-16 21:14:54 +02:00
|
|
|
|
2013-09-15 13:45:00 +02:00
|
|
|
API
|
2013-09-16 21:14:54 +02:00
|
|
|
---
|
2013-09-14 23:35:50 +02:00
|
|
|
|
2013-09-16 21:59:09 +02:00
|
|
|
Note: In case of success == false, "error" is added to the response, containing the error message.
|
|
|
|
|
|
|
|
|
2013-09-15 13:45:00 +02:00
|
|
|
GET retrieve data
|
|
|
|
PUT put a whole dataset (overwrite)
|
|
|
|
POST update a dataset (update given parts only)
|
|
|
|
DELETE delete/destroy something
|
2013-09-14 23:35:50 +02:00
|
|
|
|
|
|
|
|
2013-09-15 13:45:00 +02:00
|
|
|
GET /user {} {success, user: {%USER_DOCUMENT%}}
|
|
|
|
PUT /user {username, password, email} {success}
|
|
|
|
POST /user {username, password, email} {success}
|
2013-09-16 21:14:54 +02:00
|
|
|
DELETE /user {} {success}
|
2013-09-14 23:35:50 +02:00
|
|
|
|
2013-09-15 13:45:00 +02:00
|
|
|
GET /profile {} {success, profile: {%PROFILE_DOCUMENT}}
|
|
|
|
PUT /profile {profile} {success}
|
|
|
|
DELETE /profile {} {success}
|
2013-09-14 23:35:50 +02:00
|
|
|
|
2013-09-15 13:45:00 +02:00
|
|
|
GET /session {} {success, login}
|
|
|
|
PUT /session {username, password} {success}
|
|
|
|
DELETE /session {} {success}
|