This repo contains the whole backend for the blog application. Frontend can be found here.
- Node.js v8
- Express.js
- MongoDB
Keep in mind that this application uses MongoDB, which should be installed on your local machine. Run mongod and mongo, then import sample data:
> mongod
> mongo
> mongoimport --db test-database --collection posts --file mongo-import.json
where test-database is a name of the database and posts is a collection name.
To make text search (by title or post's content) available, you have to create text indexes.
- Run Mongo shell
mongo
- Select a proper database
use test-database
- Create text index on posts collection
db.posts.createIndex({title: "text", content: "text"})
-
Go to the project directory
-
Install all dependencies
npm install
-
Run server
node server.js
Server should log that it's listening on localhost and specific port (5000 by default).
From your project directory run only one command:
npm testx
There is a couple of things, which need to be improved:
- posts collection: creating, deleting and updating posts
- users collection: the whole CRUD of users
- tests for above points