This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build and clarify set up instructions
- Loading branch information
1 parent
5f07cd1
commit ef9d5e3
Showing
10 changed files
with
51 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PGUSER=postgres | ||
PGPASSWORD=postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,4 +67,7 @@ package-lock.json | |
# MacOS | ||
.DS_Store | ||
|
||
bin | ||
# Environment variables | ||
.env | ||
|
||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ 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 the 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. | ||
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. | ||
|
||
|
@@ -16,29 +16,47 @@ Fork this repo with your solution. Ideally, we'd like to see your progression th | |
|
||
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. | ||
|
||
## Install | ||
## Installing | ||
|
||
Make sure that you have a modern version of `yarn` that supports workspaces (`>= 1.0`), then run: | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
You will also need to [install Postgres](https://www.postgresqltutorial.com/install-postgresql-macos/), create a `challenge` database and load the sql file `dump.sql`: | ||
Start a Postgres Docker container, or alternatively run postgres outside docker. | ||
|
||
```bash | ||
psql challenge < dump.sql | ||
docker run --name pleo-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres | ||
``` | ||
|
||
## Start | ||
Copy the `.env.example` file as `.env` and optionally update it to reflect the proper authentication for your locally running Postgres instance. | ||
|
||
```bash | ||
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. | ||
|
||
```bash | ||
psql -d "postgresql://postgres:[email protected]" -c 'CREATE DATABASE pleo_node_challenge' | ||
``` | ||
|
||
Insert some dummy data: | ||
|
||
```bash | ||
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` | ||
|
||
```bash | ||
NODE_DEBUG=DEBUG yarn start | ||
``` | ||
|
||
## Test | ||
## Testing | ||
|
||
Make sure that you have a modern version of `yarn` that supports workspaces, then run: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import config from 'config'; | ||
|
||
config.auth.jwtSecret = 'some-fake-key'; | ||
|
||
process.env.TEST_MODE = 'test'; | ||
|
||
process.on('unhandledRejection', (err: Error) => process.stderr.write(`unhandledRejection: ${err.stack}\n`)); |