Application is powered by Express
In order to run the development version:
Clone repository, checkout master branch
Install globally nodeJS.
Enter repository: cd gooru
Run "npm install"
Whenever everything successfully complete, run "grunt serve"
In your default browser you will see a new tab: "http://localhost:9000/
===========
In order to run the production version of app:
do all the above mentioned steps,
in CLI or on continuous deployment server run "grunt build"
deploy application and link your server by running "node app" inside of your server Installation
===========
Application is serving static build ready files from public folder
Static files are generated by a parallel repo in front-end as a result of "grunt build"
command in the respective repo
===========
In order to test application run "grunt test" command
////////////////////////////////////////////////////// //// Potential Scheme //////////////////////////////////////////////////////
channel:{ _id: randomID, isDeleted: false, title: 'Channel title', ownerId: 'opa', isPrivate: true, users: [ { title: 'Channel's title for this user', joinDate: '12.10.1996', user: 'fagagasgaga' } ], topicsId: ['awhofqfa7fh9a8w0f', '9ugawf8a8fgahwf0a8wfa'] }
user: { _id: randomID, isDeleted: false, name: 'Vlad', login: 'opa', passhordHash: '97yirhqjkhfojafo', passwordSalt: 'w0ahfihawf92hfqo', address: 'Saratov, Russia', profession: 'FE Developer', biography: 'Student', avatar: 'cool.png', channels: ['aojdnadl;', 'andonad;ad'], favoritePosts: ['wpanfonaflka','anbalfnansfpaf'], likedPosts: ['aljdnjalda','apjfja;faf'] }
topic: { _id: randomID, isDeleted: false, hashTag: '#cool', description: 'My cool topic', author: 'apndobadonad', date: '20.20.1000', childPosts: ['sgagasgsagag', 'gasljgoalska'], }
post: { _id: randomID, isDeleted: false, test: 'My text', date: '11.04.2014', author: 'adnjpajjhad', childPosts: ['sgagasgsagag', 'gasljgoalska'], usersFavorite:['apndkjafbnaf', 'abfihaslnf;amf;'], usersLike: ['slafjpjaflmaf;', 'saoppfnalnflknasfp'] }////////////////////////////////////////////////////// //// Mongoose Scheme //////////////////////////////////////////////////////
var Channel = new mongoose.Schema({ title: {type: String, required: true}, isPrivate: {type: Boolean, default: false}, gooru: {type: types.ObjectId, ref: 'User', required: true}, topics: [{type: types.ObjectId, ref: 'Topic'}], users: [{ user: {type: types.ObjectId, ref: 'User'}, title: String, joinDate: {type: Date, default: Date.now} }], isDeleted: {type: Boolean, default: false} });
var Post = new mongoose.Schema({ text: {type: String}, date: Date, author: {type: types.ObjectId, ref: 'User'}, usersLike: [{type: types.ObjectId, ref: 'User'}], usersFavorite: [{type: types.ObjectId, ref: 'User'}], childPosts: [{type: types.ObjectId, ref: 'Post'}], isDeleted: {type: Boolean, default: false} });
var Topic = new mongoose.Schema({ hashTag: {type: String}, description: {type: String}, date: Date, author: [{type: types.ObjectId, ref: 'User'}], childPosts: [{type: types.ObjectId, ref: 'Post'}], isDeleted: {type: Boolean, default: false} });
var User = new mongoose.Schema({ login: {type: String, required: true, unique: true}, passwordHash: {type: String, required: true}, passwordSalt: {type: String}, avatar: {type: String}, address: {type: String, required: true}, name: {type: String}, profession: {type: String}, biography: {type: String}, channels: [{type: types.ObjectId, ref: 'Channel'}], favoritePosts: [{type: types.ObjectId, ref: 'Post'}], likedPosts: [{type: types.ObjectId, ref: 'Post'}], isDeleted: {type: Boolean, default: false} });////////////////////////////////////////////////////// //// Queries //////////////////////////////////////////////////////
/////////////////////User/////////////////////////////
'/api/users/bylogin/:login' GET Ïîëó÷åíèÿ ïîëüçîâàòåëÿ ïî username :login = username '/api/users/likes/:id' GET Ïîëó÷åíèå ïîñòîâ, êîòîðûå ïîëüçîâàòåëü ëàéêíóë :id = Id ïîëüçîâàòåëÿ '/api/users/favorites/:id' GET Ïîëó÷åíèå ïîñòîâ, êîòîðûå ïîëüçîâàòåëü äîáàâèë â èçáðàííîå :id = Id ïîëüçîâàòåëÿ '/api/users/logout' GET Ðàçëîãèíèâàíèå ïîëüçîâàòåëÿ, âûõîä èç òåêóùåé ñåññèè '/api/users' GET Ïîëó÷åíèå ñïèñêà þçåðîâ '/api/users/channel' POST Äîáàâëåíèå þçåðà â êàíàë Ïàðàìåòðû channelId userId channelTitle - êàê äëÿ ïîëüçîâàòåëÿ áóäåò íàçûâàòüñÿ êàíàë (ïî óìîë÷àíèþ ðàâåí íàçâàíèþ êàíàëà) '/api/users/channel/remove' POST Óäàëåíèå þçåðà èç êàíàëà (òîëüêî ñàì þçåð ìîæåò ñåáÿ óäàëèòü) Ïàðàìåòðû channelId userId '/api/users/login' POST Signin ïîëüçîâàòåëÿ Ïàðàìåòðû login, password '/api/users/signup' POST Ðåãèñòðàöèÿ ïîëüçîâàòåëÿ Ïàðàìåòðû login password name address avatar profession biography '/api/users/:id' PUT Ðåäàêòèðîâàíèå ïîëüçîâàòåëÿ :id - ID ïîëüçîâòåëÿ Ïàðàìåòðû login ÈËÈ name ÈËÈ address ÈËÈ avatar ÈËÈ profession ÈËÈ biography '/api/users/:id' DELETE Óäàëåíèå ïîëüçîâàòåëÿ :id - ID ïîëüçîâàòåëÿ
'/api/channels' GET Ïîëó÷åèå âåõ êàíàëîâ '/api/channels/:id' GET Ïîëó÷åíèå êàíàëà ïî ID :id - ID êàíàëà '/api/channel/topics/:id' GET Ïîëó÷åíèå òîïèêîâ â êàíàëå :id - ID êàíàëà '/api/channel/users/:id' GET Ïîëó÷åíèå þçåðîâ â êàíàëå :id - ID êàíàëà '/api/channels' POST Äîáàâëåíèå êàíàëà Ïàðàìåòðû title isPrivate (íåîáÿçàòåëüíî ïîëå) gooru (ñîçäàòåëü êàíàëà) '/api/channels/:id' DELETE Óäàëåíèå êàíàëà :id - ID êàíàëà
'/api/topics' GET Ïîëó÷åíèå âñåõ òîïèêîâ '/api/topics/posts/:id' GET Ïîëó÷åíèå âñåõ ïîñòîâ â òîïèêå :id - ID òîïèêà '/api/topics' POST Äîáàâëåíèå òîïèêà Ïàðàìåòðû hashTag (íàçâàíèå) description author (id àâòîðà) '/api/topics/:id' DELETE Óäàëåíèå òîïèêà :id - ID òîïèêà '/api/topics/posts' PUT Ïðåâðàùåíèå ïîñòà â òîïèêà Ïàðàìåòðû hashTag id (ID ïîñòà)
'/api/posts/like/:id' GET Ëàéêíóòü ïîñò :id - Id ïîñòà '/api/posts/favor/:id' GET Äîáàâèòü ïîñò â èçáðàííîå :id - Id ïîñòà '/api/posts' POST Äîáàâèòü ïîñò Ïàðàìåòðû text authorId '/api/posts/:id' DELETE Óäàëèòü ïîñò :id - ID ïîñòà