Skip to content

evelinawahlstrom/ad-assignment-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👩‍💻 ADLUDIO ASSIGNMENT 👩‍💻

What this project is about:

Two tasks were given to me from Adludio to evalutate my technical skills as a junior developer.
I was given three days to complete the tasks:

  • Task 1: Mainly Front End - see related repository Adludio client
  • Task 2: Backend - this repository

TASK 2:

  • "ODIDULA" That's a string of letters. If we were to create an array of all the possible permutations of these letters, sort them alphabetically and remove repetitions, which index would ADLUDIO be at? :)

Create a single REST JSON endpoint that solves that puzzle GET /permutation-index/{someStringHere}
The endpoint will respond with a json object with one key:
{ "indexOfGivenPermutation": 34 }
And the value 34 above is an example of the position of the given permutation in a sorted array of all permutations (when repetitions are omitted)
For example:
Request GET /permutation-index/LABA
Response { "indexOfGivenPermutation": 11 }

Table of contents:

Technologies used:

  • Express, Sequelize, bcrypt, cors, pg

How to install

Note You will need to create a container on your computer for the database. I've used Docker

  1. Clone this repo

git clone https://github.com/evelinawahlstrom/ad-assignment-server

  1. cd into adludio-server

  2. In your terminal, run the following command to install all the dependencies

npm install
  1. To start the terminal with nodemon, use the following command (assumes nodemon is installed globally)
nodemon index
  1. To start the code without tracking saved changes, you can simply run:
node index

As a standard I'm using port 4000 for this server.

  1. Start the database
With the help of docker, connect with the password 'secret'

Features working

  • router.post/'register' for registering, the password will be encrypted with the help of bcrypt
  • router.get/'/permutation-index/ADLUDIO' will create an array of all possible combinations, sort them alphabetically and then find the index of ADLUDIO leading to a response as a json object (see gif below)

adludio-server

About

Express API (REST) - Technical assignment given by Adludio to complete in 3 days

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published