70 lines
1.5 KiB
Plaintext
70 lines
1.5 KiB
Plaintext
Development notes
|
|
=================
|
|
|
|
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
|
|
------------------
|
|
|
|
user document:
|
|
{
|
|
"_id": "%NICKNAME%",
|
|
"auth": "%SCRYPTHASH%",
|
|
"email": "%USERMAIL%",
|
|
"type": "user",
|
|
"profile": "%COUCHDOCID_PROFILE%"
|
|
}
|
|
|
|
profile document:
|
|
{
|
|
"_id": "%COUCHDOCID%",
|
|
"_attachments": {%COUCHATTACHMENTS%}
|
|
"type": "profile",
|
|
"data": {
|
|
//the object that is handled
|
|
}
|
|
}
|
|
|
|
|
|
API
|
|
---
|
|
|
|
Note: In case of success == false, "error" is added to the response, containing the error message.
|
|
|
|
|
|
GET retrieve data
|
|
PUT put a whole dataset (overwrite)
|
|
POST update a dataset (update given parts only)
|
|
DELETE delete/destroy something
|
|
|
|
|
|
GET /user {} {success, user: {%USER_DOCUMENT%}}
|
|
PUT /user {username, password, email} {success}
|
|
POST /user {username, password, email} {success}
|
|
DELETE /user {} {success}
|
|
|
|
GET /profile {} {success, profile: {%PROFILE_DOCUMENT}}
|
|
PUT /profile {profile} {success}
|
|
DELETE /profile {} {success}
|
|
|
|
GET /profile/store/%FILENAME% {} {success}
|
|
PUT /profile/store/%FILENAME% {file} {success}
|
|
DELETE /profile/store/%FILENAME% {} {success}
|
|
|
|
GET /session {} {success, login}
|
|
PUT /session {username, password} {success}
|
|
DELETE /session {} {success} |