a web based code editor for developing frontend websites. you can write html, css, javascript and view the resualt at the same time and also you can share your work with others
This project is a complex backend project that is built with nodejs, expressjs, mongodb, mongoose, jwt, bcrypt, nodemailer, and many more. This project is a complete backend project that has all the features that a backend project should have.
I build a complete online code editing and publishing web app similar to codepen with all the features like login, signup, create new project(web), like, dislike, comment, reply, follow, unfollow, upload assets(image, video, audio, and others) and many more.
- signup (create new user)
- login
- logout
- get current logedin user
- email verification
- send welcome email
- forgot password
- reset password
- update user info
- delete user
- create new web
- get all webs
- get single web
- update web
- delete web
- like web
- dislike web
- comment on web
- reply on comment
- delete comment
- delete reply
- upload assets
- get all assets
- get single asset
- update asset
- delete asset
- follow user
- unfollow user
- get all followers
- get all followings
- nodejs
- expressjs
- mongodb
- mongoose
- jwt
- bcrypt
- nodemailer
- cloudinary
- multer
- and many more
if you want to use this project in your frontend web app or mobile app then you can follow this documentation.
in this documentation I use axios to make http request to the backend server. so if you want to use this project in your frontend web app or mobile app then you can use axios to make http request to the backend server or you can use any other library to make http request to the backend server.
function createNewUser({username,email,password,fullName,verificationURL=""}) {
const data = {
username,
email,
password,
fullName,
verificationURL // redirect url for email verification
}
axios.post("https://yourdomain.com/api/v1/users/register", data)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function login({identifier,password}) {
const data = {
identifier, // username or email
password
}
axios.post("https://yourdomain.com/api/v1/users/login", data)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function logout() {
axios.post("https://yourdomain.com/api/v1/users/logout?fromAllDevices=true")
// fromAllDevices=true means logout from all devices if you want to logout from current device then remove this query parameter
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function refreshAccessToken() {
axios.post("https://yourdomain.com/api/v1/users/refresh-token")
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getCurrentUser() {
axios.get("https://yourdomain.com/api/v1/users/me")
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function requestVerifyEmail({verificationURL=""}) {
axios.post("https://yourdomain.com/api/v1/users/request-verify-email",{verificationURL})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function verifyEmail({token}) {
axios.post("https://yourdomain.com/api/v1/users/verify-email",{token})
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function sendForgotPasswordEmail({email,resetPasswordURL=""}) {
axios.post("https://yourdomain.com/api/v1/users/request-forgot-password-email",{email,resetPasswordURL})
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function resetPassword({token,newPassword}) {
axios.post("https://yourdomain.com/api/v1/users/reset-password",{token,newPassword})
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateUserInfo(data) {
// data = {fullName,bio,link1,link2,link3}
axios.patch("https://yourdomain.com/api/v1/users/update",{...data})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function changePassword({oldPassword,newPassword}) {
axios.post("https://yourdomain.com/api/v1/users/change-password",{oldPassword,newPassword})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function changeEmail({email,password,verificationURL}) {
axios.post("https://yourdomain.com/api/v1/users/change-email",{email,password,verificationURL})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteUser({password}) {
axios.delete("https://yourdomain.com/api/v1/users/delete",{password})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateAvatar({image,public_id}) {
// avatar = avatar url
axios.patch("https://yourdomain.com/api/v1/users/update-avatar",{image,public_id})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateCoverImage({image,public_id}) {
// coverImage = cover image url
axios.patch("https://yourdomain.com/api/v1/users/update-cover-image",{image,public_id})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getUserProfile({username}) {
axios.get(`https://yourdomain.com/api/v1/users/profile/${username}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getShowcaseItems({username}) {
axios.get(`https://yourdomain.com/api/v1/users/showcase/${username}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getPinedItems({page,limit}) {
axios.get(`https://yourdomain.com/api/v1/users/pined?page=${page}&limit=${limit}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function addToPinedItems({webId}) {
axios.patch(`https://yourdomain.com/api/v1/users/add-to-pined/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function removeFromPinedItems({webId}) {
axios.patch(`https://yourdomain.com/api/v1/users/remove-pined/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateShowcase({showcase}) {
axios.patch(`https://yourdomain.com/api/v1/users/update-showcase`,{showcase})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function checkUsernameAvailability({username}) {
axios.get(`https://yourdomain.com/api/v1/users/check-username-availability/${username}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchUsers({search,page=1,limit=6}) {
axios.get(`https://yourdomain.com/api/v1/users/search?search=${search}&page=${page}&limit=${limit}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function createWeb({title,description,html="",css="",js="",isPublic,image,cssLinks=[],jsLinks=[]}) {
const formData = new FormData();
formData.append('image', image, 'my-image-name.jpeg');
formData.append('title', title);
formData.append('description', description);
formData.append('html', html);
formData.append('css', css);
formData.append('js', js);
formData.append('isPublic', isPublic);
formData.append('cssLinks', JSON.stringify(cssLinks));
formData.append('jsLinks', JSON.stringify(jsLinks));
axios.post("https://yourdomain.com/api/v1/webs/create",formData,{
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function forkWeb({webId,title,description,isPublic}) {
axios.post(`https://yourdomain.com/api/v1/webs/create-forked/${webId}`,{title,description,isPublic})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getWebById({webId}) {
axios.get(`https://yourdomain.com/api/v1/webs/${webId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllWebByUsername ({username,queryParameters="page=1&limit=4&webType=public"}) {
// queryParameters = string contains all querys of url
// valid querys are webType , sortBy, sortOrder, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/user/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllWebByUsername ({username,queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are sortBy, sortOrder, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/liked/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getMyFollowingUsersWebs ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are sortBy, sortOrder, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/following?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getTrendingWebs ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/trending?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getYourWorkWebs ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are sortBy, sortOrder, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/your-work?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchFromMyWebs ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are search, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/search/my-webs?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function showRecomendedPeoplesToFollow ({queryParameters="page=1&limit=8"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/recomended-people?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateWeb ({webId,title,description,html,css,js,image}) {
const formData = new FormData();
formData.append('image', image, 'my-image-name.jpeg');
formData.append('title', title);
formData.append('description', description);
if(html) formData.append('html', html);
if(css) formData.append('css', css);
if(js) formData.append('js', js);
axios.patch(`https://yourdomain.com/api/v1/webs/update/${webId}`,formData,{
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteWeb ({webId}) {
axios.delete(`https://yourdomain.com/api/v1/webs/delete/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function addNewCssLink ({webId,cssLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/add-css-link/${webId}`,{cssLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function removeCssLink ({webId,cssLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/remove-css-link/${webId}`,{cssLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function addNewJsLink ({webId,jsLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/add-js-link/${webId}`,{jsLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function removeJsLink ({webId,jsLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/remove-js-link/${webId}`,{jsLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function addNewTag ({webId,htmlLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/add-html-link/${webId}`,{htmlLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function removeTag ({webId,htmlLink}) {
axios.patch(`https://yourdomain.com/api/v1/webs/remove-html-link/${webId}`,{htmlLink})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function togglePublishStatus ({webId}) {
axios.patch(`https://yourdomain.com/api/v1/webs/toggle-publish-status/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function increaseViews ({webId}) {
axios.patch(`https://yourdomain.com/api/v1/webs/inc-view/${webId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchFromAllWebs ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are search, page, limit;
axios.get(`https://yourdomain.com/api/v1/webs/search/all-webs?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getEditorPreferences () {
axios.get(`https://yourdomain.com/api/v1/webs/editor-preferences`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateEditorPreferences (editorPreferences) {
axios.patch(`https://yourdomain.com/api/v1/webs/update-editor-preferences`,{...editorPreferences})
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function createNewCollection ({name,description,isPublic=true}) {
axios.post(`https://yourdomain.com/api/v1/collections/create`,{name,description,isPublic=true})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateCollection ({collectionId,name,description}) {
axios.patch(`https://yourdomain.com/api/v1/collections/update/${collectionId}`,{name,description})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteCollection ({collectionId}) {
axios.delete(`https://yourdomain.com/api/v1/collections/delete/${collectionId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function addWebToCollection ({collectionId,webId}) {
axios.patch(`https://yourdomain.com/api/v1/collections/add-web/${collectionId}/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function removeWebFromCollection ({collectionId,webId}) {
axios.patch(`https://yourdomain.com/api/v1/collections/remove-web/${collectionId}/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function togglePublishStatusOfCollection ({collectionId}) {
axios.patch(`https://yourdomain.com/api/v1/collections/toggle-publish-status/${collectionId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function increaseViewsOfCollection ({collectionId}) {
axios.patch(`https://yourdomain.com/api/v1/collections/inc-view/${collectionId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getCollectionByCollectionId ({collectionId}) {
axios.get(`https://yourdomain.com/api/v1/collections/get/${collectionId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getCollectionWebsByCollectionId ({collectionId,queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/collections/get-webs/${collectionId}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllCollectionsByUsername ({username,queryParameters="page=1&limit=4&collectionType=public"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , sortBy, sortOrder, collectionType;
axios.get(`https://yourdomain.com/api/v1/collections/user-collection/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getCollectionsCreatedByUser ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , sortBy, sortOrder;
axios.get(`https://yourdomain.com/api/v1/collections/my-collections?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getLikedCollectionsByUsername ({username,queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , sortBy, sortOrder;
axios.get(`https://yourdomain.com/api/v1/collections/liked/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchFromAllCollections ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are search, page, limit;
axios.get(`https://yourdomain.com/api/v1/collections/search/all-collections?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchFromMyCollections ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are search, page, limit;
axios.get(`https://yourdomain.com/api/v1/collections/search/my-collections?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function checkCollectionNameAvailability ({name}) {
axios.get(`https://yourdomain.com/api/v1/collections/check-name-availability/${name.replaceAll(" ","-")}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function createNewAsset ({title,assetType,assetURL,assetPublicId,isPublic=true}) {
axios.post(`https://yourdomain.com/api/v1/assets/create`,{title,assetType,assetURL,assetPublicId,isPublic})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllAssetsCreatedByMe ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , assetType;
axios.get(`https://yourdomain.com/api/v1/assets/my-assets?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllPublicAssets ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , assetType;
axios.get(`https://yourdomain.com/api/v1/assets/get?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function searchFromAllAssets ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are search, page, limit, assetType;
axios.get(`https://yourdomain.com/api/v1/assets/search/all-assets?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAssetByAssetId ({assetId}) {
axios.get(`https://yourdomain.com/api/v1/assets/get/${assetId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteAsset ({assetId}) {
axios.delete(`https://yourdomain.com/api/v1/assets/delete/${assetId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateAsset ({assetId,title,isPublic=true}) {
axios.patch(`https://yourdomain.com/api/v1/assets/update/${assetId}`,{title,isPublic})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAssetsLikedByMe ({queryParameters="page=1&limit=4"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit , assetType;
axios.get(`https://yourdomain.com/api/v1/assets/liked?${queryParameters}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function createNewComment ({web,text}) { // web = web id
axios.post(`https://yourdomain.com/api/v1/comments/create`,{web,text})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateComment ({commentId,text}) {
axios.patch(`https://yourdomain.com/api/v1/comments/update/${commentId}`,{text})
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteComment ({commentId}) {
axios.delete(`https://yourdomain.com/api/v1/comments/delete/${commentId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllCommentsByWebId ({webId,queryParameters="page=1&limit=20"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/comments/get-comments/${webId}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getCommentByCommentId ({commentId}) {
axios.get(`https://yourdomain.com/api/v1/comments/get/${commentId}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function createNewReply ({commentId,text}) {
axios.post(`https://yourdomain.com/api/v1/replays/create`,{commentId,text}) // in my next project i will use replyTo
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function updateReply ({replayId,text}) {
axios.patch(`https://yourdomain.com/api/v1/replays/update/${replayId}`,{text})
// it is my mistake i use replay instead of reply but i can't change it now because it will break my project
// it is recommended to use reply instead of replay in frontend
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function deleteReply ({replayId}) {
axios.delete(`https://yourdomain.com/api/v1/replays/delete/${replayId}`)
// it is my mistake i use replay instead of reply but i can't change it now because it will break my project
// it is recommended to use reply instead of replay in frontend
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllRepliesByCommentId ({commentId,queryParameters="page=1&limit=20"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/replays/get-replays/${commentId}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function likeWeb ({webId}) {
axios.post(`https://yourdomain.com/api/v1/likes/web/${webId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function likeAsset ({assetId}) {
axios.post(`https://yourdomain.com/api/v1/likes/asset/${assetId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function likeCollection ({collectionId}) {
axios.post(`https://yourdomain.com/api/v1/likes/collection/${collectionId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function likeComment ({commentId}) {
axios.post(`https://yourdomain.com/api/v1/likes/comment/${commentId}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function likeReply ({replayId}) {
axios.post(`https://yourdomain.com/api/v1/likes/replay/${replayId}`)
// it is my mistake i use replay instead of reply but i can't change it now because it will break my project
// it is recommended to use reply instead of replay in frontend
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function toggleFollowUnfollowUser ({username}) {
axios.post(`https://yourdomain.com/api/v1/followers/toggle/${username}`)
.then(res => {
// only possible if you already logged in
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllFollowersByUserId ({username,queryParameters="page=1&limit=20"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/followers/get-followers/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function getAllFollowingsByUserId ({username,queryParameters="page=1&limit=20"}) {
// queryParameters = string contains all querys of url
// valid querys are page, limit;
axios.get(`https://yourdomain.com/api/v1/followers/get-followings/${username}?${queryParameters}`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
function helthCheck () {
axios.get(`https://yourdomain.com/api/v1/healthCheck`)
.then(res => {
console.log(res.data)
})
.catch(err => {
console.log(err.message)
})
}
This project is made with nodejs and mongodb. so if you want to run this project in your local system then ensure to follow the below steps.
install nodejs and mongodb in your local system and ensure that they are working properly.
To clone this project in your local system you first create a folder and then open that folder in your terminal and then run the below command.
git clone https://github.com/kuntal-hub/codeweb-backend.git
before running this command make sure that you have git installed in your local system.
move to the project directory by running the below command.
cd codeweb-backend
after cloning this project in your local system you need to install all the dependencies that are used in this project. to install all the dependencies run the below command in your terminal.
npm install
this command will install all the dependencies that are used in this project.
after installing all the dependencies you need to create a .env file in the root directory of this project and then copy all the content from .env.example file and paste it in .env file and then change the value of all the variables according to your need.
after doing all the above steps you are ready to run this project in your local system. to run this project in your local system run the below command in your terminal.
npm run dev
congratulations now you have successfully run this project in your local system.
This project is open for contributions. If you want to contribute in this project, you can follow the below steps.
fork this project in your github account by clicking on the fork button.
clone the repository by running the following command in your terminal
git clone <your-forked-repository-url>
change the directory to codeweb-frontend by running the following command in your terminal
cd <cloned-repository-name>
install the dependencies by running the following command in your terminal
npm install
after installing all the dependencies you need to create a .env file in the root directory of this project and then copy all the content from .env.example file and paste it in .env file and then change the value of all the variables according to your need.
make the changes in the project according to your need. like adding new features, fixing bugs, improving the UI, etc.
after doing all the above steps you are ready to run this project in your local system. to run this project in your local system run the below command in your terminal.
npm run dev
after making the changes you need to push the changes to your forked repository by running the following command in your terminal
git add .
git commit -m "your commit message"
git push origin <your-branch-name>
after pushing the changes to your forked repository you need to create a pull request to the main repository. you can create a pull request by clicking on the create pull request button.
congratulations 🎉 now you have successfully created a pull request. Now, the maintainers of this project will review your pull request and if everything is fine then your pull request will be merged.