Giter VIP home page Giter VIP logo

fcc-microservices's Introduction

API Project: Timestamp Microservice for FCC

User stories :

  1. The API endpoint is GET [project_url]/api/timestamp/:date_string?
  2. A date string is valid if can be successfully parsed by new Date(date_string) (JS) . Note that the unix timestamp needs to be an integer (not a string) specifying milliseconds. In our test we will use date strings compliant with ISO-8601 (e.g. "2016-11-20") because this will ensure an UTC timestamp.
  3. If the date string is empty it should be equivalent to trigger new Date(), i.e. the service uses the current timestamp.
  4. If the date string is valid the api returns a JSON having the structure {"unix": <date.getTime()>, "utc" : <date.toUTCString()> } e.g. {"unix": 1479663089000 ,"utc": "Sun, 20 Nov 2016 17:31:29 GMT"}.
  5. If the date string is invalid the api returns a JSON having the structure {"unix": null, "utc" : "Invalid Date" }. It is what you get from the date manipulation functions used above.

Example usage:

Example output:

  • { "unix": 1450137600, "natural": "December 15, 2015" }

API Project: Request Header Parser Microservice for freeCodeCamp

/api/whoami

User stories:

  1. I can get the IP address, preferred languages (from header Accept-Language) and system infos (from header User-Agent) for my device.

Example usage:

  • [base_url]/api/whoami

Example output:

  • {"ipaddress":"159.20.14.100","language":"en-US,en;q=0.5","software":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"}

API Project: URL Shortener Microservice for freeCodeCamp

/api/shorturl

User Stories

  1. I can POST a URL to [project_url]/api/shorturl/new and I will receive a shortened URL in the JSON response. Example : {"original_url":"www.google.com","short_url":1}
  2. If I pass an invalid URL that doesn't follow the valid http(s)://www.example.com(/more/routes) format, the JSON response will contain an error like {"error":"invalid URL"}. HINT: to be sure that the submitted url points to a valid site you can use the function dns.lookup(host, cb) from the dns core module.
  3. When I visit the shortened URL, it will redirect me to my original link.

Creation Example:

POST [project_url]/api/shorturl/new - body (urlencoded) : url=https://www.google.com

Usage:

[this_project_url]/api/shorturl/3

Will redirect to:

https://www.freecodecamp.org/forum/


Exercise Tracker REST API

A microservice project, part of Free Code Camp's curriculum

User Stories

Form is served in /api/exercises

  1. I can create a user by posting form data username to /api/exercises/new/user and returned will be an object with username and _id.
  2. I can get an array of all users by getting api/exercise/users with the same info as when creating a user.
  3. I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercises/new/exercise. If no date supplied it will use current date. Returned will the the user object with also with the exercise fields added.
  4. I can retrieve a full exercise log of any user by getting /api/exercises/log/ with a parameter of username. Return will be the user object with added array log and count (total exercise count).
  5. I can retrieve part of the log of any user by also passing along optional parameters of from & to or limit. (Date format yyyy-mm-dd, limit = int)

API Project: File Metadata Microservice for freeCodeCamp

/api/file-upload

User stories:

  1. I can submit a form that includes a file upload.
  2. The form file input field has the "name" attribute set to "upfile". We rely on this in testing.
  3. When I submit something, I will receive the file name and size in bytes within the JSON response

Usage :

  • Go to the main page, and upload a file using the provided form.

Hint:

  • To handle the file uploading you should use the multer npm package.

fcc-microservices's People

Contributors

nikalsson avatar

Watchers

James Cloos avatar  avatar

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.