Write a small web application in one of the above languages (Python/Ruby/Javascript). The application only needs to do the following: Accept a POST request to the route “/test”, which accepts one argument “string_to_cut” Return a JSON object with the key “return_string” and a string containing every third letter from the original string
(e.g.) If you POST {"string_to_cut": "iamyourlyftdriver"}, it will return: {"return_string": "muydv"}.
- JavaScript
- Express
- Body-Parser
Make sure you have Node installed - Follow this Guide
*Be sure to not include $
at the start of each command
1.Make a new Directory - via the command line in Terminal enter:
$ mkdir newfolder && ch /path/to/newfolder
- Clone the repo
$ git clone https://github.com/dmccoy1/crypto-parser.git
- Inside the cloned repo directory - Install NPM packages
$ npm install
- Run App
The app will console out:
$ node app.js
Listening on port 80
- Open a new Terminal Window while the app the is running. Enter:
$ curl -X POST http://127.0.0.1:80/test --data '{"string_to_cut": "iamyourlyftdriver"}' -H 'Content-Type: application/json'
Output should be:
{"return_string": "muydv"}