Mehulcoder / BOCS-TASK

This will have all the files created for the BOCS task

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BOCS Task

This repository will contain all the files of the tasks given for BOCS internship. It has two folders for each of the respective questions.

Getting Started

Prerequisites

You should have the following installed on your local machine:

NodeJs
npm
Terminal
POSTMAN

Below are the download links for the same:

Install them and then move to the next step.

Extracting

  • Download and extract the repository.

  • Start terminal and change working directory to the extracted repository.


Running

Question 1: String Permutations

  • Open terminal and change your working directory to Coding-Question where you have the file perms.js

I have added all the comments explaining the algo behind the code.

  • Open perms.js and change the variable input on line 44 to your desired test input string
  • Now in the terminal, type node perms.js
  • You'll get the output in the terminal

Question 2 : Weather App

  • Change the directory in the terminal to API-question which has app.js file in it.
  • In the terminal type and run npm install to install the required packages.
  • After the installation, in the terminal type node app.js or nodemon app.js.

You can set your apikey by changing the apikey variable in app.js to the one that you got from the openweathermap.org website. For testing purposes I've entered mine already, so no need to worry.

  • In the terminal you'll see Server is on port 3000 means that the application is successfully running on PORT 3000

In case of error make sure that port 3000 is not used by some other application.

  • Open POSTMAN application, name your collection as BOCS. And click this button on the top left.

*enter image description here

  • Name the request as weather.

  • Now change the Request type from GET to POST

enter image description here

  • Enter request url as localhost:3000
  • Now to enter the lattitude and longitude, click on body tab and switch to x-www-form-urlencoded
  • You need to enter the two following keys and their numerical values:
    • lat
    • lon

enter image description here

  • Click on send now. If everything goes fine you'll get Status: 200 in the POSTMAN

  • You can see the output in both:

    • Terminal and

    enter image description here

    • POSTMAN

enter image description here

Built With

  • NodeJs

  • npm dependencies:

    • request 2.88.2
    • express 4.16.14

Authors

Acknowledgments

I enjoyed doing this task and I tried to make this README as detailed as possible. If you have any queries you can E-mail me at mehul170104047@iitg.ac.in or mehul355180@gmail.com.

About

This will have all the files created for the BOCS task


Languages

Language:JavaScript 96.1%Language:CSS 3.9%