adesege / nyt-most-popular-articles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NYT Most Popular Articles

Tech & Stacks

Installing

The easiest way to install the application is through Docker and Docker-compose. Follow the links to install Docker and Docker-compose if you haven't.

Before you start

  • Follow the instructions here on how to get your API key on NYT developer website.
  • Rename the .env-sample files in client and server folders. You can leave the default values as it is if you will be running on Docker. If not, feel free to change the values accordingly
  • Ensure you add the API key you got by following step 1 above in ./server/.env. The environment key is NYT_API_KEY.

Using Docker

# Run setup.sh to create docker volumes first
$ ./setup.sh

# Run this command in case you are having permission issues
$ chmod 755 setup.sh

# Ensure your Docker daemon is up and running
$ docker -v
$ docker-compose -v

# Build and start your container by running
$ docker-compose up --build
  • Frontend can be accessed via localhost:3000
  • Backend can be accessed via localhost:5000

Manually

Ensure Nodejs 10.9.0+ and Yarn 1.13.0+ are installed.

# Verify Nodejs and Yarn installation
# Run the following command on your terminal

$ node -v # 10.9.0
$ yarn -v # 1.13.0

# (Optional) If you have nvm installed, you can just run
$ nvm use

# Installing dependencies
# Ensure you are in the root of the project
$ yarn pre-setup

Building & Starting the application

Development environment

# To run the server and client in parallel
$ yarn start:dev

# To start only the server
$ cd server && yarn start:dev

# To start only the client
$ cd client && yarn dev

Production environment

# To build both client and client in parallel
# Ensure you are in the root of the project before running this command
$ yarn build

# To build only the server
$ cd server && yarn build

# To build only the client
$ cd client && yarn build

# To start the server and client in parallel
# Ensure you are in the root of the project before running this command
$ yarn start

# To start only the server
$ cd server && yarn start

# To start only the client
$ cd client && yarn start

Ensure you are in the root of the project before running those commands.

  • Client can be accessed via http://localhost:3000

  • Api can be accessed via http://localhost:5000

Testing

  • Cypress was used as the end-to-end testing framework on the Frontend
  • Some contract tests were written on the backend to ensure that the response payload contains the right value.
# To run the client test
$ cd client
$ yarn test

# To run the server test
$ cd server
$ yarn test:e2e

Stay in touch

License

All rights reserved.

About

License:MIT License


Languages

Language:TypeScript 40.9%Language:JavaScript 30.4%Language:Vue 25.2%Language:Dockerfile 1.6%Language:Shell 1.3%Language:CSS 0.6%