Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const ProductSchema = new Schema({ | |
name: String, | |
price: Number, | |
category: String, | |
image: String, | |
description: String | |
}); |
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const CategorySchema = new Schema({ | |
title: String | |
}); | |
module.exports = mongoose.model('Category', CategorySchema); |
const express = require('express'); | |
const router = express.Router(); | |
const faker = require('faker'); | |
const Product = require('../../models/Product'); | |
const Category = require('../../models/Category'); | |
router.get('/', function (req, res, next) { | |
const categories = ["Baby", "Movies", "Shoes", "Books", "Electronics","Computers", "Kids"]; | |
for (let i = 0; i < 20; i++) { | |
let product = new Product({ |
const express = require('express'); | |
const router = express.Router(); | |
const Product = require('../models/Product'); | |
router.get('/', function (req, res, next) { | |
let perPage = 3; | |
let page = parseInt(req.query.page) || 0; | |
let pages = 0; | |
let nextUrl = ''; |
const express = require('express'); | |
const router = express.Router(); | |
const Category = require('../models/Category'); | |
const Product = require('../models/Product'); | |
router.get('/', function (req, res, next) { | |
Category.find(function (err, categories) { | |
if (err) return console.log(err); | |
res.status(200).json(categories); |
<template> | |
<div id="app"> | |
<Navbar /> | |
<router-view /> | |
</div> | |
</template> | |
<script> | |
import Navbar from './components/Navbar.vue' |
<template> | |
<div> | |
<Cards :products="products" /> | |
<p class="text-center mb-0">{{currentPage+1 }} / {{ pages }}</p> | |
<ul class="pagination justify-content-center"> | |
<li class="page-item" :class="{disabled: prevUrl === ''}"> | |
<button class="page-link" @click="checkPage(prevUrl)">Previous</button> | |
</li> | |
<li class="page-item" :class="{disabled: nextUrl === ''}"> | |
<button class="page-link" @click="checkPage(nextUrl)">Next</button> |
<template> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-4 mb-3" v-for="product in products" :key="product._id"> | |
<Card :product="product" /> | |
</div> | |
</div> | |
</div> | |
</template> |