GithubHelp home page GithubHelp logo

wf-node's Introduction

WeFox Challenge

Requirements & considerations

  • The Node.js version must be the newest release.
  • Usage of Typescript is highly encouraged.
  • The EcmaScript version to follow should be the newest one supported by that Node.js version.
  • All the endpoints URLs and HTTP methods should be as standard as possible.
  • Server must use Express.js.
  • The database models required are open to your considerations.
  • Use any package that you may consider relevant (ORMs, utilities and so on). Take into account that we might ask about why you used them!

Nice to have

  • External services dockerized.
  • External services added in docker-compose.
  • Use of Jest for the tests.

External services

  • MongoDB

External APIs

  • Google Maps Geocoding API
  • Open Weather API

Note: These APIs are proposed due to being very popular and easy to use, but require registration. If you don’t want to register in these services, you can use the Nominatim API from Openstreetmaps and 7Timer!.

Exercise

  • Create a REST API Node.js project that can handle validations and retrieve the data only from the previously mentioned external APIs.

  • Setup a Express.js server with MongoDB services to handle authentication through access tokens (OAuth2-like). This authentication must validate the execution of any create, update and delete endpoints. Tokens must expire after 10h.

  • Add an endpoint to login following the OAuth2 standard.

  • Add an endpoint that receives an address and validate if its real with Google Maps. This address must be in an object with the properties street, streetNumber, town, postalCode and country. This endpoint isn’t authenticated and it shouldn’t check any token.

  • Add an endpoint that receives an address and check the weather with the latitude and longitude of that address. This endpoint is authenticated and it should check the user credentials.

  • Add relevant tests (unit, integration and E2E). You do not need to cover all of the application but we expect to have basic coverage to evaluate.

Nice to have

  • Cache the usages of external services for 12 hours. For example: If an address has been checked in that timeframe, shouldn’t be requested against the external API again.

  • Add the OpenAPI (Swagger) endpoint definition for your amazing API.

Setup

Postman link

Postman link

You need to configure the next Environment Vars: HOST, PORT, TOKEN (should be obtained with signin endpoint)

Postman file

Postman file

You need to configure the next Environment Vars: HOST, PORT, TOKEN (should be obtained with signin endpoint)

Run project

git clone https://github.com/Beny1912/wf-node.git

cd wf-node

docker-compose up

Run test

git clone https://github.com/Beny1912/wf-node.git

cd wf-node

npm i

npm run test

Run project dev

Global requirements:

Node 17.3.0

Docker Desktop

MongoDB

Global npm packages

Eslint

Typescript

Jest

Prettier

Nodemon

Husky

git clone https://github.com/Beny1912/wf-node.git

cd wf-node

npm i

npm run start-dev

wf-node's People

Contributors

beny1912 avatar

Watchers

 avatar Lucas Fernandez Bodereau avatar

wf-node's Issues

**Configure Local Machine Environments and Project**

  • Create a new project
  • Update Version NodeJS with nvm
  • Configure Typescript
  • Configure ECMAScript
  • Configure Eslint, Prettier & Husky
  • Add basic libraries (Express, etc...)
  • Create scaffolding & Architecture of project
  • Add Basic Dockerfile
  • Generate first Jest test

**Add endpoint get Weather**

  • Create API Token Open Weather
  • Add library
  • Create Service OpenWeather
  • Create Endpoint
  • Create function Address to coordinates in googleService
  • Testing with Postman
  • Testing with Jest

**Create Endpoint CheckAddress**

  • Create Google cloud Account
  • Billing Account
  • Create API key Geocoding API
  • Create Services GoogleMapService
  • Create endpoint
  • Testing with jest
  • Create request in postman

**Create Local Services MongoDB**

  • Install docker
  • Create docker compose
  • Test docker connection and persistence
  • Config env project connection
  • Add mongoose to project

**Configure Local Machine Environments and Project**

  • Create a new project
  • Update Version NodeJS with nvm
  • Configure Typescript
  • Configure ECMAScript
  • Configure Eslint, Prettier & Husky
  • Add basic libraries (Express, etc...)
  • Create scaffolding & Architecture of project
  • Add Basic Dockerfile
  • Generate first Jest test

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.