Skip to content

katarzyna-dusza/blog-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend for a blog application

Overview

This repo contains the whole backend for the blog application. Frontend can be found here.

Technologies

  • Node.js v8
  • Express.js
  • MongoDB

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.

  1. Run Mongo shell
mongo
  1. Select a proper database
use test-database
  1. Create text index on posts collection
db.posts.createIndex({title: "text", content: "text"})

Run server

  1. Go to the project directory

  2. Install all dependencies

    npm install
  3. Run server

    node server.js

Server should log that it's listening on localhost and specific port (5000 by default).

Run tests

From your project directory run only one command:

npm testx

Roadmap

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

About

Backend for the blog application written in NodeJS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published