Git Product home page Git Product logo

alt-tab---node.js-coding-challenge-public's Introduction

AltTab Coding Challenge

Configurations ๐ŸŽ‰

  • Everything is configurable at app/config/config.json.
  • PM2 configurations are in process.config.js.

Server

"server": {
  "protocol": "http",
  "host": "localhost",
  "port": 3000,
  "instances": 3
}

Services

{
  "name": "dummy",
  "path": "/dummy",
  "method": "get",
  "version": 1,
  "params": {
    "name": {
      "required": true,
      "type": "string"
    },
    "id": {
      "required": true,
      "type": "number",
      "is": ["integer", "positive"]
    },
    "email": {
      "required": true,
      "type": "string",
      "is": "email"
    },
    "age": {
      "required": true,
      "type": "number"
    },
    "gender": {
      "required": true,
      "type": "string",
      "is": {
        "inArray": [["male", "female"]]
      }
    }
  }
}

Cool Things ๐Ÿ˜€

  • DI module.
  • Router module.
  • API versioning.
  • Core modules loading desing pattern load().
  • The require() is only allowed in app.js check the comment in app.js.
  • Params Schema (Check app/config/config.json).
  • More types of middlewares (before, service, controller, after, fail).
  • Fully documented code, have fun reading it ๐Ÿ˜€.
  • A middleware to separate the validation from the services' code.
  • Run a cluster of the app via PM2, configured in app/config/config.json.

Bad Things ๐Ÿ˜“

  • I wrapped the response with {meta: {}, data: {HERE}}. In real world we should not break the API unless we agreed on this. I did it this time to allow you to have a look to my framework.
  • I used the minimal parts of a framework that I built from more than 3 years. Some parts of the code need a revamp since they have a really bad implementation, consistency, naming, documentation like router.js, response.js, tasks.js, helpers/validate.js, most of the middlewares, helpers, misc modules, etc.

Getting Started

PreRequisites:

  • MongoDB v3.6.5
  • Node.js v6.9.1

Setting up the project

In the project directory run

npm install

Starting the application

This project runs via PM2 as cluster, you can configure the number of instances in app/config/config.json file

npm start

Running the tests

The test suite can be run with

npm test

About Me

Mohammad Anas Fares, Senior Software Engineer at Amazon.

alt-tab---node.js-coding-challenge-public's People

Contributors

faressoft avatar malevski avatar tekdel avatar

Watchers

 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.