Lightweight, dynamic blog engine for Node.
NodePress is a blog engine for Node web servers. It's designed to be fast to use and attach to your existing project. It works like a bridge between your database and the client, making it simple to have users posting and fetching posts.
NodePress uses Mongo as database and Express/Socket.io for client-server communication.
1. Get NodePress
npm install nodepress
2. Add it to your project by using
const NodePress = ;const nodePress = ;
3. Configure NodePress according to your project/database variables and information.
// Your database infoconst databaseInfo =ip: 'localhost'port: '27017'name: 'myDb'requireLogon: 'false'user: 'myUser'password: 'myPassword';const cfg =mongoClient: MongoClient // the mongodb clientmongoURL: NodePress // get mongoURL by databaseInfohttpServer: // a HTTP serverpostsPerPage: 10 // how many posts per page to fetchpostsCollection: 'posts' // posts' collection name;nodePress;
4. Initialize NodePress and add listeners.
5. Initialize Socket.io in the client and listen for server events.
const socket = ;var page = 1;// Will request posts from page '1'socket;socket;
6. To publish a post in the client is very simple. According to the above server socket listener 'post':
var post =title: 'My Title'author: 'My Name'body: 'Hi there!';socket;
7. For a full Client example, please check the /example/client folder files.