Counts all word occurrence in a web page source. You can visit it here.
- Node.js (platform)
- MongoDB (database)
- npm (package/dependency manager)
-
Clone this repo.
-
Install MongoDB. https://www.mongodb.com/
-
Run MongoDB server in the background or foreground, whichever you like.
$ nohup mongod &
-
Navigate to the cloned repository and install dependencies
$ cd /path/to/repo $ npm install
-
Set up environment variables.
- MONGODB_URI - the URI for the MongoDB instance
- PORT - For Node.js projects, port
3000
is commonly used. - DEBUG - set to
true
if on local environment
-
Install
nodemon
globally if you haven't yet.$ npm install nodemon -g
-
Fire up the application.
$ nodemon
Just provide the API with the url
and word
parameter. The request should look like this:
https://node-wordcounterapi.herokuapp.com/wordcount?url=http://virtusize.jp&word=fit
New query result will be saved to a MongoDB database for faster access.