Hashcash is a simple proof of work algorithm to prevent or slow down spam. It works by giving the requester a challenge in the form of a sha1 hash. After the hash is received the requesting client has four seconds to find a hash of the challenge + number that has three leading zeros. The client can find the challenge in the header: hashcash-challenge and add the answer to hashcash-answer.
Using the middleware on an end-point in express will prevent the client from accessing the resource until an answer is found. A new challenge is created every four seconds.
npm install hashcash
var hashcash = ;var express = ;var app = express;app;var port = 8080;console;app;