├── .gitignore ├── readme.md ├── .DS_Store ├── public ├── .DS_Store ├── images │ ├── .DS_Store │ ├── image.png │ ├── logo.png │ └── uploads │ │ └── .DS_Store └── stylesheets │ └── style.css ├── views ├── error.ejs ├── partials │ ├── header.ejs │ └── footer.ejs ├── login.ejs ├── index.ejs ├── search.ejs ├── edit.ejs ├── profile.ejs ├── upload.ejs ├── userprofile.ejs └── feed.ejs ├── routes ├── story.js ├── multer.js ├── posts.js ├── users.js └── index.js ├── package.json ├── utils └── utils.js ├── app.js └── bin └── www /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | HQ instagram clone -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/.DS_Store -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/public/.DS_Store -------------------------------------------------------------------------------- /views/error.ejs: -------------------------------------------------------------------------------- 1 |

<%= message %>

2 |

<%= error.status %>

3 |
<%= error.stack %>
4 | -------------------------------------------------------------------------------- /public/images/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/public/images/.DS_Store -------------------------------------------------------------------------------- /public/images/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/public/images/image.png -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/public/images/logo.png -------------------------------------------------------------------------------- /public/images/uploads/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asynchronousJavascriptor/instaclone/HEAD/public/images/uploads/.DS_Store -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | .story::-webkit-scrollbar{ 2 | display: none; 3 | } 4 | 5 | a:focus { 6 | outline: none !important; 7 | } -------------------------------------------------------------------------------- /routes/story.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const storySchema = mongoose.Schema({ 4 | user: { 5 | type: mongoose.Schema.Types.ObjectId, 6 | ref: "user" 7 | }, 8 | story: String, 9 | date: { 10 | type: Date, 11 | default: Date.now 12 | } 13 | }) 14 | 15 | 16 | module.exports = mongoose.model("story", storySchema); -------------------------------------------------------------------------------- /views/partials/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /routes/multer.js: -------------------------------------------------------------------------------- 1 | const multer = require("multer"); 2 | const path = require("path"); 3 | const crypto = require("crypto"); 4 | 5 | const storage = multer.diskStorage({ 6 | destination: function (req, file, cb) { 7 | cb(null, "./public/images/uploads"); 8 | }, 9 | filename: function (req, file, cb) { 10 | const fn = 11 | crypto.randomBytes(16).toString("hex") + path.extname(file.originalname); 12 | cb(null, fn); 13 | }, 14 | }); 15 | 16 | const upload = multer({ storage: storage }); 17 | module.exports = upload; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "insta", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "cookie-parser": "~1.4.4", 10 | "debug": "~2.6.9", 11 | "ejs": "~2.6.1", 12 | "express": "~4.16.1", 13 | "express-session": "^1.17.3", 14 | "http-errors": "~1.6.3", 15 | "mongoose": "^8.0.4", 16 | "morgan": "~1.9.1", 17 | "multer": "^1.4.5-lts.1", 18 | "passport": "^0.7.0", 19 | "passport-local": "^1.0.0", 20 | "passport-local-mongoose": "^8.0.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /routes/posts.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const postSchema = mongoose.Schema({ 4 | user: { 5 | type: mongoose.Schema.Types.ObjectId, 6 | ref: "user" 7 | }, 8 | caption: String, 9 | like: [{ 10 | type: mongoose.Schema.Types.ObjectId, 11 | ref: "user" 12 | }], 13 | comments: { 14 | type: Array, 15 | default: [] 16 | }, 17 | date: { 18 | type: Date, 19 | default: Date.now 20 | }, 21 | shares: [{ 22 | type: mongoose.Schema.Types.ObjectId, 23 | ref: "user" 24 | }], 25 | picture: String 26 | }) 27 | 28 | 29 | module.exports = mongoose.model("post", postSchema); -------------------------------------------------------------------------------- /views/partials/footer.ejs: -------------------------------------------------------------------------------- 1 | <% if(footer){ %> 2 | 12 | <% } %> 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /views/login.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 |
4 | 5 |
6 | 7 | 8 | 9 |
10 | Don't have an account ? Sign Up 11 |
12 |
13 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /utils/utils.js: -------------------------------------------------------------------------------- 1 | var utils = { 2 | formatRelativeTime: function (date) { 3 | const now = new Date(); 4 | const diff = now - date; 5 | 6 | // Convert milliseconds to seconds 7 | const seconds = Math.floor(diff / 1000); 8 | 9 | if (seconds < 60) { 10 | return `${seconds}s`; 11 | } 12 | 13 | const minutes = Math.floor(seconds / 60); 14 | 15 | if (minutes < 60) { 16 | return `${minutes}m`; 17 | } 18 | 19 | const hours = Math.floor(minutes / 60); 20 | 21 | if (hours < 24) { 22 | return `${hours}h`; 23 | } 24 | 25 | const days = Math.floor(hours / 24); 26 | 27 | if (days < 7) { 28 | return `${days}d`; 29 | } 30 | 31 | const weeks = Math.floor(days / 7); 32 | 33 | return `${weeks}w`; 34 | } 35 | } 36 | module.exports = utils; -------------------------------------------------------------------------------- /routes/users.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const plm = require("passport-local-mongoose"); 3 | 4 | mongoose.connect("mongodb://127.0.0.1:27017/instainsta"); 5 | 6 | const userSchema = mongoose.Schema({ 7 | username: String, 8 | name: String, 9 | email: String, 10 | password: String, 11 | picture: { 12 | type: String, 13 | default: "def.png" 14 | }, 15 | contact: String, 16 | bio: String, 17 | stories: [ 18 | { 19 | type: mongoose.Schema.Types.ObjectId, 20 | ref: "story" 21 | } 22 | ], 23 | saved: [ 24 | { 25 | type: mongoose.Schema.Types.ObjectId, 26 | ref: "post" 27 | } 28 | ], 29 | posts: [{ 30 | type: mongoose.Schema.Types.ObjectId, 31 | ref: "post" 32 | }], 33 | followers: [ 34 | { 35 | type: mongoose.Schema.Types.ObjectId, 36 | ref: "user" 37 | } 38 | ], 39 | following: [ 40 | { 41 | type: mongoose.Schema.Types.ObjectId, 42 | ref: "user" 43 | } 44 | ] 45 | }) 46 | 47 | userSchema.plugin(plm); 48 | 49 | module.exports = mongoose.model("user", userSchema); -------------------------------------------------------------------------------- /views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 |
4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 |
12 | Already have an account ? Log In 13 |
14 |
15 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var createError = require('http-errors'); 2 | var express = require('express'); 3 | var path = require('path'); 4 | var cookieParser = require('cookie-parser'); 5 | var logger = require('morgan'); 6 | var expressSession = require('express-session'); 7 | 8 | var indexRouter = require('./routes/index'); 9 | var usersRouter = require('./routes/users'); 10 | const passport = require('passport'); 11 | 12 | var app = express(); 13 | 14 | // view engine setup 15 | app.set('views', path.join(__dirname, 'views')); 16 | app.set('view engine', 'ejs'); 17 | 18 | app.use(expressSession({ 19 | resave: false, 20 | saveUninitialized: false, 21 | secret: "heyheyehhdd" 22 | })); 23 | app.use(passport.initialize()); 24 | app.use(passport.session()); 25 | passport.serializeUser(usersRouter.serializeUser()); 26 | passport.deserializeUser(usersRouter.deserializeUser()); 27 | 28 | app.use(logger('dev')); 29 | app.use(express.json()); 30 | app.use(express.urlencoded({ extended: false })); 31 | app.use(cookieParser()); 32 | app.use(express.static(path.join(__dirname, 'public'))); 33 | 34 | app.use('/', indexRouter); 35 | app.use('/users', usersRouter); 36 | 37 | // catch 404 and forward to error handler 38 | app.use(function(req, res, next) { 39 | next(createError(404)); 40 | }); 41 | 42 | // error handler 43 | app.use(function(err, req, res, next) { 44 | // set locals, only providing error in development 45 | res.locals.message = err.message; 46 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 47 | 48 | // render the error page 49 | res.status(err.status || 500); 50 | res.render('error'); 51 | }); 52 | 53 | module.exports = app; 54 | -------------------------------------------------------------------------------- /views/search.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 |
4 | 5 | 7 |
8 |
9 | 10 |
11 |
12 | 13 | 43 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('insta:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /views/edit.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 | 3 | 6 | 7 |
8 |
9 | profile 10 |

Edit Profile

11 | home 12 |
13 |
14 |
15 | 16 |
17 | 18 |
19 |
20 |

Edit Account Details

21 |
22 |
23 | 24 | 25 | 26 | 27 |
28 |
29 |
30 | 31 | 41 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /views/profile.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 | 10 |
11 |
12 | 13 |
14 |
15 |
16 |

<%= user.posts.length %>

17 |

Posts

18 |
19 |
20 |

<%= user.followers.length %>

21 |

Followers

22 |
23 |
24 |

<%= user.following.length %>

25 |

Following

26 |
27 |
28 |
29 |
30 |

<%= user.name %>

31 |

<%= user.bio ?? "You have not set anything yet, (click edit profile to set)" %>

32 |
33 |
34 | Edit Profile 35 |
36 |
37 | <% if(user.posts.length>0){ %> 38 | <% user.posts.reverse().forEach(function(post){ %> 39 |
40 | 41 |
42 | <% }) %> 43 | <% } else { %> 44 |
45 | no posts yet. 46 |
47 | <% } %> 48 |
49 |
50 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /views/upload.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 |
4 | profile 5 |

Upload Post

6 | home 7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 |
15 |
post
16 |
story
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 | 57 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /views/userprofile.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 | 10 |
11 |
12 | 13 |
14 |
15 |
16 |

<%= userprofile.posts.length %>

17 |

Posts

18 |
19 |
20 |

<%= userprofile.followers.length %>

21 |

Followers

22 |
23 |
24 |

<%= userprofile.following.length %>

25 |

Following

26 |
27 |
28 |
29 |
30 |

<%= userprofile.name %>

31 |

<%= userprofile.bio ?? "You have not set anything yet, (click edit profile to set)" %>

32 |
33 |
34 | <% if(user.following.indexOf(userprofile._id) === -1){ %> 35 | Follow 36 | <% } else { %> 37 | Following 38 | <% } %> 39 | Message 40 | Contact 41 |
42 |
43 | <% if(userprofile.posts.length>0){ %> 44 | <% userprofile.posts.reverse().forEach(function(post){ %> 45 |
46 | 47 |
48 | <% }) %> 49 | <% } else { %> 50 |
51 | no posts yet. 52 |
53 | <% } %> 54 |
55 |
56 | <% include ./partials/footer.ejs %> -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require("express"); 2 | var router = express.Router(); 3 | const passport = require("passport"); 4 | const localStrategy = require("passport-local"); 5 | const userModel = require("./users"); 6 | const postModel = require("./posts"); 7 | const storyModel = require("./story"); 8 | passport.use(new localStrategy(userModel.authenticate())); 9 | const upload = require("./multer"); 10 | const utils = require("../utils/utils"); 11 | 12 | 13 | // GET 14 | router.get("/", function (req, res) { 15 | res.render("index", { footer: false }); 16 | }); 17 | 18 | router.get("/login", function (req, res) { 19 | res.render("login", { footer: false }); 20 | }); 21 | 22 | router.get("/like/:postid", async function (req, res) { 23 | const post = await postModel.findOne({ _id: req.params.postid }); 24 | const user = await userModel.findOne({ username: req.session.passport.user }); 25 | if (post.like.indexOf(user._id) === -1) { 26 | post.like.push(user._id); 27 | } else { 28 | post.like.splice(post.like.indexOf(user._id), 1); 29 | } 30 | await post.save(); 31 | res.json(post); 32 | }); 33 | 34 | router.get("/feed", isLoggedIn, async function (req, res) { 35 | let user = await userModel 36 | .findOne({ username: req.session.passport.user }) 37 | .populate("posts"); 38 | 39 | let stories = await storyModel.find({ user: { $ne: user._id } }) 40 | .populate("user"); 41 | 42 | var uniq = {}; 43 | var filtered = stories.filter(item => { 44 | if(!uniq[item.user.id]){ 45 | uniq[item.user.id] = " "; 46 | return true; 47 | } 48 | else return false; 49 | }) 50 | 51 | let posts = await postModel.find().populate("user"); 52 | 53 | res.render("feed", { 54 | footer: true, 55 | user, 56 | posts, 57 | stories: filtered, 58 | dater: utils.formatRelativeTime, 59 | }); 60 | }); 61 | 62 | router.get("/profile", isLoggedIn, async function (req, res) { 63 | let user = await userModel 64 | .findOne({ username: req.session.passport.user }) 65 | .populate("posts") 66 | .populate("saved"); 67 | console.log(user); 68 | 69 | res.render("profile", { footer: true, user }); 70 | }); 71 | 72 | router.get("/profile/:user", isLoggedIn, async function (req, res) { 73 | let user = await userModel.findOne({ username: req.session.passport.user }); 74 | 75 | if (user.username === req.params.user) { 76 | res.redirect("/profile"); 77 | } 78 | 79 | let userprofile = await userModel 80 | .findOne({ username: req.params.user }) 81 | .populate("posts"); 82 | 83 | res.render("userprofile", { footer: true, userprofile, user }); 84 | }); 85 | 86 | router.get("/follow/:userid", isLoggedIn, async function (req, res) { 87 | let followKarneWaala = await userModel.findOne({ 88 | username: req.session.passport.user, 89 | }); 90 | 91 | let followHoneWaala = await userModel.findOne({ _id: req.params.userid }); 92 | 93 | if (followKarneWaala.following.indexOf(followHoneWaala._id) !== -1) { 94 | let index = followKarneWaala.following.indexOf(followHoneWaala._id); 95 | followKarneWaala.following.splice(index, 1); 96 | 97 | let index2 = followHoneWaala.followers.indexOf(followKarneWaala._id); 98 | followHoneWaala.followers.splice(index2, 1); 99 | } else { 100 | followHoneWaala.followers.push(followKarneWaala._id); 101 | followKarneWaala.following.push(followHoneWaala._id); 102 | } 103 | 104 | await followHoneWaala.save(); 105 | await followKarneWaala.save(); 106 | 107 | res.redirect("back"); 108 | }); 109 | 110 | router.get("/search", isLoggedIn, async function (req, res) { 111 | let user = await userModel.findOne({ username: req.session.passport.user }); 112 | res.render("search", { footer: true, user }); 113 | }); 114 | 115 | router.get("/save/:postid", isLoggedIn, async function (req, res) { 116 | let user = await userModel.findOne({ username: req.session.passport.user }); 117 | 118 | if (user.saved.indexOf(req.params.postid) === -1) { 119 | user.saved.push(req.params.postid); 120 | } else { 121 | var index = user.saved.indexOf(req.params.postid); 122 | user.saved.splice(index, 1); 123 | } 124 | await user.save(); 125 | res.json(user); 126 | }); 127 | 128 | router.get("/search/:user", isLoggedIn, async function (req, res) { 129 | const searchTerm = `^${req.params.user}`; 130 | const regex = new RegExp(searchTerm); 131 | 132 | let users = await userModel.find({ username: { $regex: regex } }); 133 | 134 | res.json(users); 135 | }); 136 | 137 | router.get("/edit", isLoggedIn, async function (req, res) { 138 | const user = await userModel.findOne({ username: req.session.passport.user }); 139 | res.render("edit", { footer: true, user }); 140 | }); 141 | 142 | router.get("/upload", isLoggedIn, async function (req, res) { 143 | let user = await userModel.findOne({ username: req.session.passport.user }); 144 | res.render("upload", { footer: true, user }); 145 | }); 146 | 147 | router.post("/update", isLoggedIn, async function (req, res) { 148 | const user = await userModel.findOneAndUpdate( 149 | { username: req.session.passport.user }, 150 | { username: req.body.username, name: req.body.name, bio: req.body.bio }, 151 | { new: true } 152 | ); 153 | req.login(user, function (err) { 154 | if (err) throw err; 155 | res.redirect("/profile"); 156 | }); 157 | }); 158 | 159 | router.post( 160 | "/post", 161 | isLoggedIn, 162 | upload.single("image"), 163 | async function (req, res) { 164 | const user = await userModel.findOne({ 165 | username: req.session.passport.user, 166 | }); 167 | 168 | if (req.body.category === "post") { 169 | const post = await postModel.create({ 170 | user: user._id, 171 | caption: req.body.caption, 172 | picture: req.file.filename, 173 | }); 174 | user.posts.push(post._id); 175 | } else if (req.body.category === "story") { 176 | let story = await storyModel.create({ 177 | story: req.file.filename, 178 | user: user._id, 179 | }); 180 | user.stories.push(story._id); 181 | } else { 182 | res.send("tez mat chalo"); 183 | } 184 | 185 | await user.save(); 186 | res.redirect("/feed"); 187 | } 188 | ); 189 | 190 | router.post( 191 | "/upload", 192 | isLoggedIn, 193 | upload.single("image"), 194 | async function (req, res) { 195 | const user = await userModel.findOne({ 196 | username: req.session.passport.user, 197 | }); 198 | user.picture = req.file.filename; 199 | await user.save(); 200 | res.redirect("/edit"); 201 | } 202 | ); 203 | 204 | // POST 205 | 206 | router.post("/register", function (req, res) { 207 | const user = new userModel({ 208 | username: req.body.username, 209 | email: req.body.email, 210 | name: req.body.name, 211 | }); 212 | 213 | userModel.register(user, req.body.password).then(function (registereduser) { 214 | passport.authenticate("local")(req, res, function () { 215 | res.redirect("/profile"); 216 | }); 217 | }); 218 | }); 219 | 220 | router.post( 221 | "/login", 222 | passport.authenticate("local", { 223 | successRedirect: "/feed", 224 | failureRedirect: "/login", 225 | }), 226 | function (req, res) {} 227 | ); 228 | 229 | router.get("/logout", function (req, res) { 230 | req.logout(function (err) { 231 | if (err) { 232 | return next(err); 233 | } 234 | res.redirect("/login"); 235 | }); 236 | }); 237 | 238 | function isLoggedIn(req, res, next) { 239 | if (req.isAuthenticated()) { 240 | return next(); 241 | } else { 242 | res.redirect("/login"); 243 | } 244 | } 245 | 246 | module.exports = router; 247 | -------------------------------------------------------------------------------- /views/feed.ejs: -------------------------------------------------------------------------------- 1 | <% include ./partials/header.ejs %> 2 |
3 |
4 | 5 |
6 | 7 | 8 |
9 |
10 |
11 | 12 |
13 |
15 |
16 | 17 |
18 |
19 |
20 |
21 | <% stories.forEach(function(story){ %> 22 | 23 |
24 |
26 |
27 | 28 |
29 |
30 |
31 |
32 | <% }) %> 33 |
34 |
35 | <% posts.reverse().forEach(function(post){ %> 36 |
37 |
38 |
39 | 40 |
41 |

42 | <%= post.user.username %> 43 |

44 |
45 | <%= dater(new Date(post.date)) %> 46 |
47 |
48 |
49 | 51 |
52 |
53 |
54 | <% if(post.like.indexOf(user._id)===-1){ %> 55 | 56 | <% } else { %> 57 | 58 | <% } %> 59 | 60 | 61 |
62 | <% if(user.saved.indexOf(post.id)===-1){ %> 63 | 64 | <% } else { %> 65 | 66 | <% } %> 67 |
68 |

69 | <%= post.like.length %> likes 70 |

71 |

72 | 73 | <%= post.user.username %> 74 | 75 | <%= post.caption %> 76 |

77 |
78 | <% }) %> 79 |
80 |
81 | 82 | 85 | 185 | 186 | 187 | <% include ./partials/footer.ejs %> --------------------------------------------------------------------------------