Giter Site home page Giter Site logo

reddigg's Introduction

reddigg

Build Status Coverage Status Codacy Badge

A reddit/digg clone (hence the portmanteau name) for Carousell Coding Exercise. A topic aggregator application -- users can submit topics and upvote/downvote topics. The homepage shows the top 20 topics sorted by score.

Try it out at https://reddigg-pykbbjxyfr.now.sh

Proudly written using vim.

Setup

Make sure you have Node.js and yarn/npm installed.

Clone the repository, then run these commands: (you can substitute yarn with npm)

yarn install
yarn build
yarn start

For deployment to Zeit Now, simply run yarn global add now or npm install -g now to install the Now CLI, then run now on the repository.

Back-end RESTful API

You can implement your own front-end too utilising the back-end API!

Backend API server responds in JSON -- to check whether your request succeeded you can either check for key success to be true, or the HTTP status code (200 for success, 400 for failure)

Getting all topics

GET /all

Creating new topic

POST /new

key type
title string

Upvoting a topic

PUT /upvote/:id

Downvoting a topic

PUT /downvote/:id

Technology Stack

Front-end

  • Next.js framework (a minimalistic framework for server-rendered React application)
  • Bootstrap for styling and FontAwesome

This is my first time developing a web application using a JavaScript/React web framework, so I researched and considered either create-react-app or Next.js. I eventually went with Next.js because it is minimalistic, more opinionated (convention-over-configuration which makes rapid development easier for me), and comes with an easy integration with Zeit Now for deployment.

Back-end

  • Node.js

I wrote a simple model for Topic and TopicManager.

The data structure used is JavaScript Array. The reasoning is that JavaScript is an interpreted language, so internal implementation of Array differs for different JavaScript engines. However, Array is a commonly used data structure, and so it is usually highly optimised by the JavaScript engine. Moreover, many standard libraries to deal with Array also allows more rapid development, and allows my application to benefit from future improvements to the functions in the standard library.

In any case, my assumption is that the dataset is small, so using standard library is a good enough trade-off for performance vs development speed (to prevent over-engineering -- premature optimisation is the root of all evil).

Testing

  • Jest
  • Enzyme
  • Sinon
  • jest-fetch-mock

Miscellaneous

  • ESLint for Linting, using Airbnb style guide
  • TravisCI for Continuous Integration
  • Coveralls for Code Coverage monitoring
  • Codacy for automated code review

reddigg's People

Contributors

indocomsoft avatar

Stargazers

 avatar

Watchers

 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.