Giter Site home page Giter Site logo

node-challenge's Introduction

⚠️ This repository was archived automatically since no ownership was defined ⚠️

For details on how to claim stewardship of this repository see:

How to configure a service in OpsLevel

To learn more about the automatic process for stewardship which archived this repository see:

Automatic process for stewardship

Node Challenge

Take home test for Node.js developers.

The challenge

This challenge has been designed to measure your knowledge of Node.js, Express, Typescript and various technologies, like monorepos, databases and testing. For your exercise, you will be enhancing this API which serves as the backend for a fictional Pleo app. Whenever a user of the app navigates to the expenses view, it calls this API to collect the list of expenses for that user.

Your objective is to write this new route to fetch the list of expenses for a given user. Right now that domain is empty, so you'll have to build everything from scratch- but you can look over at the user domain for inspiration. Please make sure that the endpoint scales adequately and supports paging, sorting and filtering. Additionally, we would also like you to write some tests for your route.

Finally, as a bonus objective, try to improve any aspect of this API. It could be to add more TS types, better security, tests, add features, graphql support, etc.

Instructions

Fork this repo with your solution. Ideally, we'd like to see your progression through commits, and don't forget to update the README.md to explain your thought process.

Please let us know how long the challenge takes you. We're not looking for how speedy or lengthy you are. It's just really to give us a clearer idea of what you've produced in the time you decided to take. Feel free to go as big or as small as you want.

Installing

Make sure that you have a modern version of yarn that supports workspaces (>= 1.0), then run:

yarn

Start a Postgres Docker container, or alternatively run Postgres outside docker.

docker run --name pleo-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres

Copy the .env.example file as .env and optionally update it to reflect the proper authentication for your locally running Postgres instance.

cp .env.example .env

Create a pleo_node_challenge database in your local instance. The following two steps assume your local postgres instance is running and accessible on 0.0.0.0:5432 as user postgres with password postgres. Please update below connection string accordingly if that's not the case.

psql -d "postgresql://postgres:[email protected]" -c 'CREATE DATABASE pleo_node_challenge'

Insert some dummy data:

psql -d "postgresql://postgres:[email protected]/pleo_node_challenge" < insert-dummy-data.sql

Running

To enable logs, use the standard NODE_DEBUG flag with the value DEBUG

NODE_DEBUG=DEBUG yarn start

Testing

Make sure that you have a modern version of yarn that supports workspaces, then run:

yarn test

The command above will run the following test suites sequentially:

Test suite Run command Description
Unit yarn test:unit Simple unit tests.
Mid-level yarn test:mid-level Small integration tests that integration of small components together.
Acceptances yarn test:acceptance Large integration tests, system tests, end-to-end tests.

Happy hacking 😁!

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.