This code challenge tests your backend skills.
We had a super GDPR compliant server for a list of fake users, but someone deleted the implementation! Oh no! Your task is to:
- Read this
README
- Install dependencies with
yarn
ornpm
(we usually useyarn
) - Create the server implementation with the
http
server of your choice. - Make sure that the tests pass (
yarn test
) - (If you are applying for a job) Submit your work to us (See ../../README.md) and we will discuss it in the next interview!
- Server runs on port 4848 (because reasons...)
/api/users
endpoint serves all the data underdata/data.json
with status code 200/api/users/${id}
endpoint serves a single user data by ID/api/users/xxx
serves 404 not found.- All tests pass
Query:
{
user(id: 1) {
name
address {
street
}
}
}
Result:
{
"name": "Tevin Gislason",
"address": {
"street": "Vilma Freeway"
}
}
-
The tests are done with Jest but you can use the test runner of your choice if needed.
-
You'll need a GitHub account to get the API token. See settings/tokens.
-
This project uses our styleguide, which might not fit 100% to your current coding style. Not to worry, we are quite flexible with it and formatting is handled by Prettier in pre-commit phase.
We use GraphQL a lot in our projects these days. Modify the server so that the data is queryable from /graphql
endpoint
and /graphiql
serves GraphiQL IDE for exploring the data.
Hint: We quite often use Apollo for these kinds of tasks.