Code Monkey home page Code Monkey logo

node-angular-blog's Introduction

node-angular-blog

simple blog based on MEAN stack - nodejs, expressjs, mongoose and angularjs on client side

This could not be done without Angular UI libraries.

Implemented: pagination, post editing, list of post by a certain tag

planned features: admin authorization via Facebook

In order to see some data when you first run it, you can use this script to fill DB with some fake data: var Post = require('./models/post.js');

db.once('open', function callback() {
    console.log("DB connection opened");
    var tag1 = new Tag({ name: 'testTag1' });
    var tag2 = new Tag({ name: 'testTag2' });
    var deferred1 = Q.defer();
    var deferred2 = Q.defer();
    tag1.save(deferred1.makeNodeResolver());
    tag2.save(deferred2.makeNodeResolver());
    Q.allResolved([deferred1, deferred2]).then(function (obj) {
        console.log("ids are " + tag1._id + ' and' + tag2._id);
        var post1 = new Post({title: 'TestPost1', text:"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", tags: [tag1._id] });
        post1.save();

        var post2 = new Post({author: "Admin", title: 'Lorem...', text:"Lorem ipsum dolor sit amet, consectetur ...."});
        post2.save();
    });
    Post.find({tags: {$in: tagsIds}}).exec(function (err, posts) {
        if (err) {
            console.error(err);
            res.send(500);
            return;
        }
        console.log(posts);
    });

    // find and remove example
    Post.find(function (err, posts) {
        posts[0].remove();
        console.log(posts)
    });
});

Copyright 2013 Jiří Špác General MIT License if not specified else in file header.

node-angular-blog's People

Contributors

capaj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.