Giter VIP home page Giter VIP logo

article-analytic's Introduction

Project Name: Article Analytic

Technologies used:

NodeJS, ES6, EJS template engine, Bootstrap 4, MongoDB, Docker

Start mongodb if it has not started yet

brew services start/restart mongodb-community

Run mongo from terminal: mongo

Folder in S3: project-article-analytic

https://s3.console.aws.amazon.com/s3/buckets/project-article-analytic?region=eu-north-1&tab=objects

Install graphql and express-graphql

npm install jsonwebtoken --save npm install --save graphql express-graphql npm install --save mongoose npm i bcryptjs npm install --save validator npm install --save aws-sdk npm install --save multer

Run:

npm run start:dev

Deployment to AWS EC2 instance:

The live version of my solution is now up and running, and it can be found at http://support.toannotes.com/. To deploy this website, my EC2 instance needs to have Apache2 (proxy and proxy_http modes are enabled), Node (v10.18.1) and Forever installed.

  • To setup Node.js with Apache Proxy: If Node app is running on port 8080. To serve Node.js application, my Apache is configured as below:
<VirtualHost *:80>

    ServerName support.toannotes.com

    ProxyPreserveHost On
    ProxyPass / http://<SERVER IP>:8080/
    ProxyPassReverse / http://<SERVER IP>:8080

</VirtualHost>
- To start application using forever: forever start server.js

Build and run Dockerfile on local machine:

After cloning cloning this repo, we can build a docker image and run that image as a container:

  • Build: docker build -t article_analytic_app_img .
  • Run: docker run -d --restart=always --name article_analytic_app_con -p 3000:3000 article_analytic_app_img:latest
  • Check logs: docker logs --tail=10 -f article_analytic_app_con

With the container running, we can now visit the application by navigating our browser to http://localhost:3000

Note: Fetching the URLs and counting the words features have been tested with external source CNN.

Installing and Running without Dockerfile on local machine:

  • Install prerequisites: You will need Node v10.18.1 (recommended version)

  • Installing: npm install

  • Start the application: node server.js

OR (If you have nodemon installed on your local machine)

nodemon server.js

The application is up and running, let's visit the application by navigating our browser to http://localhost:3000

Note: Fetching the URLs and counting the words features have been tested with external source CNN.

REST APIs:

The input parameters are given in the request body as a JSON-encoded object.

If the API responds with HTTP-status code 200 OK, the request has been handled successfully. In case of errors or exceptions in request handling, the HTTP-status code is different from 200 OK, and more details of the error / exception may be given in the response body.

The methods available on the API are described:

Fetch all channels:

  • Endpoint: /api/channels
  • Request method: GET
  • This API has no input parameters.

Fetch all articles:

  • Endpoint: /api/articles
  • Request method: GET
  • This API has no input parameters.

Add a new channel:

  • Endpoint: /api/add-new-channel
  • Request method: POST
  • Input parameters: {name: channelName}

Delete an existing channel

  • Endpoint: /api/delete-channel
  • Request method: POST
  • Input parameters: {uuid: channelUuid}

Update an existing channel:

  • Endpoint: /api/update-channel
  • Request method: POST
  • Input parameters: {uuid: channelUuid, name: channelName}

Fetch a channel by name

  • Endpoint: /api/get-channel-by-name
  • Request method: POST
  • Input parameters: {name: channelName}

Add a new article:

  • Endpoint: /api/add-new-article
  • Request method: POST
  • Input parameters: { channel_id: channelId, source_name: articleSourceName, source_url: articleSourceURL, word_count: wordCount }

Delete an existing article:

  • Endpoint: /api/delete-article
  • Request method: POST
  • In put parameters: {word_count_range_id: wordCountRangeId}

Update an existing article:

  • Endpoint: /api/update-article
  • Request method: POST
  • Input parameters: { uuid: uuid, channel_id: channelId, source_name: articleSourceName, source_url: articleSourceURL, word_count: wordCount }

Fetch a channel by URL:

  • Endpoint: /api/get-article-by-source-url
  • Request method: POST
  • Input parameters: { source_url: articleSourceURL }

Fetch channels by word count range id:

  • Endpoint: /api/filter-articles
  • Request method: POST
  • Input parameters: { word_count_range_id: wordCountRangeId }

article-analytic's People

Contributors

nqtoancusc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.