Coder Social home page Coder Social logo

todo-router's Introduction

Live coding practice interview question

Overview

This is a FullStack Todo Application, the client is based on Todo MVC

  • Stack:
    • Client: Basic jQuery selectors, event-handlers, DOM manipulation and AJAX
    • Web Server: Node and Express with PostgreSQL
    • Database: Locally hosted PostgreSQL
    • Tests: Supertest, Chai

The Rules

As in previous interviews, you may consult official docs and reference-style resources during this coding challenge. You are encouraged to work through as much of it on your own as you can.

Setup

  • Clone this repository to your local machine
  • Install the dependencies for the project
  • Ensure your PostgreSQL server is running
  • Create a User for this exercise
  • Create a database for the exercise with your user as the owner
  • Rename the example.env file to .env and update the following fields with your database credentials:
     MIGRATION_DB_NAME=
     MIGRATION_DB_USER=
     MIGRATION_DB_PASS=
     DB_URL="postgresql://USERNAME@localhost/DATABASE_NAME"
    
  • Run the command npm run migrate -- 1 to create the database tables
  • run the command npm t
  • You should see output from 10 integration tests, all will be passing.

NOTE: Due to some deployment requirements you will need to use Postgres version 8 if you are using Node 14. Use Postgres version 7 if you are using Node 12. To change your version of Node you can use nvm.

If you decide to use Node 12 and Postgres 7 you will need to set ssl: process.env.NODE_ENV === "production" in postgrator-config and pg.defaults.ssl = process.env.NODE_ENV === "production" in server.js

Exercise

  • Todo Router
    • Create a new file name todo-router.js in the todo directory
    • Move all the endpoints from app.js to todo-router.js
    • Require the proper modules into todo-router.js and export the router
    • In app.js, mount the router on /v1/todos/ path (aka mount point)
    • Remember to update the paths on the router files.

You have completed the task when all the unit tests pass and the client application works without any errors.

todo-router's People

Contributors

vramdhanie avatar gabrielsanchez avatar alfaraday avatar

Stargazers

Denise__ avatar  avatar

Watchers

Olex Ponomarenko avatar James Cloos avatar Thomas Peterson avatar Carlos Edo avatar  avatar Eliz Par avatar Grae Drake avatar Kara Leary avatar Tati avatar  avatar  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.