Skip to content
No description, website, or topics provided.
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api
fonts
images
img
journal
public
test
views
.gitignore
README.md
app.js
gulpfile.js
handler.js
home-bg.jpg
local.0
local.ns
model.js
mongod.lock
package.json

README.md

Hapi.js Blog

-- A basic blog CMS built using the Hapi.js framework. --

The front-end has been left intentionally barebones. You won't find a single line of CSS here. For this project, the beauty is all in the back-end. The aim is to produce a simple blogging platform with a RESTful approach.

Users can:

  • create new blogposts, which will then be saved to a MongoDB database using the mongojs module.
  • read blogposts; either the individual ones or a blogpost category. If a user navigates to a category URL, (e.g. /marketing), they will then see a list of blogposts belonging to that category. Joi has been used to impose some restrictions on the requests the users send to the application. This preserves the integrity of the data that makes it into the database.
  • update blogposts, which will therefore update the entry in the database.
  • delete blogposts.

Error Messages

As you navigate the application, you may encounter some errors - particularly if you are doing perculiar/nefarious things. These errors have been left looking ugly but you should still be able to decipher what's going on. For example if you try and navigate yourself to '/cheeeeese' - then you will get an error scolding you for believing 'cheeeeese' to be a real category.

{"statusCode":400,"error":"Bad Request","message":"child "category" fails because ["category" must be one of [tech, apps, marketing]]","validation":{"source":"params","keys":["category"]}}

Getting Started:

  1. Clone the repo
  2. Run 'npm install' in your terminal to install the dependencies.

Tests:

  1. Run 'npm test'
  2. You will see:
  • a list of passing (and potentially failing) tests.
  • a coverage %.
  • details on where there is missing coverage.
You can’t perform that action at this time.