Skip to content

A small NodeJS HTTP/HTTPS server that greets you with different random messages in the language you query

Notifications You must be signed in to change notification settings

AmeyaDaddikar/Hello-Restful-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello-Restful-API

Home Assignment #1 (Pirple's NodeJS Masterclass)

This is my submission project for the first assignment for the NodeJS masterclass.

Features

  1. HTTP/HTTPS support
  2. NODE_ENV to toggle between debug modes
  3. Modularized code
  4. https POST request made to Yandex Translation API using the default NodeJS https module
  5. Every time you request /hello, it randomizes the message shown. If /hello?lang= is specified, then the Yandex API will translate it to that language.
  6. Solved a previous code-structure issue by using the Promise object to handle Async requests made to a third party.
  7. Replaced the callback() mechanism with a pathHandlerPromise object. This ensures that res object need not be passed to handlers and the callback code can be handled by the Promse itself.

Screenshot 1 Screenshot 2

P.S.

To get the translator feature to work, add the following in the file ./config/private.json (The site still works without the translator, and just returns the message in English.)

{
  "yandex_api_key" : "_your_api_key_" 
}

About

A small NodeJS HTTP/HTTPS server that greets you with different random messages in the language you query

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages