View the source on GitHub or Glitch.
I created this microservice as a requirement for my freeCodeCamp Information Security and Quality Assurance Certification, using Node.js, Express, MongoDB, Chai, and Helmet. The front end API tests on the home page also use Bootstrap, jQuery, and highlight.js.
You can read the functional tests I wrote on
GitHub
or
Glitch. To run the tests yourself, create a MongoDB database, fork/remix this
project, create a .env
file with
DB="{your MongoDB connection string}"
and
NODE_ENV="test"
, start the server, and look at the server
console logs.
This project fulfills the following user stories:
text
and delete_password
to
/api/threads/{board}. (Recomend
res.redirect
to board page /b/{board}) Saved
will be _id
, text
,
created_on
(date&time),
bumped_on
(date&time, starts same as created_on),
reported
(boolean), delete_password
, &
replies
(array).
text
, delete_password
, &
thread_id
to /api/replies/{board} and it
will also update the bumped_on
date to the comment's
date. (Recomend res.redirect
to thread page
/b/{board}/{thread_id}) In the thread's
replies
array will be saved _id
,
text
, created_on
,
delete_password
, & reported
.
reported
and
delete_password
fields will not be sent.
thread_id
& delete_password
.
(Text response will be "incorrect password"
or
"success"
)
"[deleted]"
) if I send a DELETE request to
/api/replies/{board} and pass along the
thread_id
, reply_id
, &
delete_password
. (Text response will be
"incorrect password"
or "success"
)
reported
value to
true
by sending a PUT request to
/api/threads/{board} and passing along the
thread_id
. (Text response will be "success"
)
reported
value to
true
by sending a PUT request to
/api/replies/{board} and passing along the
thread_id
& reply_id
. (Text response
will be "success"
)