The coding challenge is about implementing an app that lists shops nearby, help users to find shops that are near their location HTML5 Geolocation. and they can dislike or like shop to add on preferred list and remove them from preferred.
email: alfredojairo17@gmail.com password: alfredojairo17@gmail.com
Application is split between a back-end and a web front-end.
The front-end is a single page app with a single index.html, building with VueJS.
The back-end is a REST API building with NodeJS, adonisJS web framework and MongoDB.,
Development
To run the app on localhost, just clone the project and run npm install
in backend and frontend folder. After that you can run the backend API by running the command npm start
and launch frontend server using npm start
again. Now you can access App by typing htpp://localhost:8080 in your browser.
You can run the api test, just config .env.testing file for your environment
Production
To run the app on localhost like production environment, just clone the project and run npm install
for backend and frontend folder. After in frontend folder run npm run build
and backend run npm start.
The backend API also use Google Maps api to search and sorted shops nearby by distance the connect user.
Backend
The main logic of app is based in adonisjs. The database ORM is Lucid Mongo. The code is written in JavaScript.
resources | method | description |
---|---|---|
/api/auth/signup |
POST | create a new user passing name, email and password in the body. |
/api/auth/signin |
POST | login by passing email and password in the body. |
/api/users/me |
GET | returns all information about user. |
/api/users/likeshops |
GET | returns a list of the preferred shops of the current user. |
/api/users/dislikeshops |
GET | returns a list of the disliked shops of the current user. |
/api/users/addliked |
POST | add a specific shop into the preferred shops list of current user. |
/api/shops/adddislike/ |
POST | add a specific shop into the disliked shops list of current user. |
/api/users/removeshop/{shopId}/ |
DELETE | remove a shop from preferred shops. |
/api/shops/{latitude}/{longitude} |
GET | returns a list of shops sorted by the distance user curent location. |
To see all ressources run adonis route:list (@adonisjs/cli required)
frontend
for the frontend App has the global Architecture of an vue-cli project.