npm install
to install all node-modules.npm start
start server.npm test
run test.
- JSON request & response.
- URlemncoded(x-www-form-urlencoded) requests.
- Collection 1: for news articles
- Collection 2: for news authors
using Joi object schema const Joi = require('joi')
- Used Joi package : Created an object schema to validate the req.body.
- Used mongoose schema : mongoose ORM for Mongodb provided schema validation of db models.
- Send back the error on the response.
"scripts": { "test": "mocha --exit" }
chai-http (request testing), should & expect (Assertions)
- News countries:
countries = ['dz','us','fr','ru','in','de','tr','eg','br','ca','cz','it','ua']
- News categories:
categories =['business','entertaiment','general','health','science','sports','technologie']
"http://localhost:3000/api/news/category=sports"
"http://localhost:3000/api/news/country=dz"