Skip to content

moataz-01/freeCodeCamp_APIs_Projects_Laravel

Repository files navigation

freeCodeCamp Back End Development and APIs curriculum

build the final 5 APIs projects but using PHP/Laravel

Timestamp Microservice

  • A request to /api/:date? with a valid date should return a JSON object with a unix key that is a Unix timestamp of the input date in milliseconds (as type Number)

  • A request to /api/:date? with a valid date should return a JSON object with a utc key that is a string of the input date in the format: Thu, 01 Jan 1970 00:00:00 GMT

  • A request to /api/1451001600000 should return {unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }

  • Your project can handle dates that can be successfully parsed by new Date(date_string)

  • If the input date string is invalid, the API returns an object having the structure { error :"Invalid Date" }

  • An empty date parameter should return the current time in a JSON object with a unix key

  • An empty date parameter should return the current time in a JSON object with a utc key


Request Header Parser Microservice

  • A request to /api/whoami should return a JSON object with your IP address in the ipaddress key.

  • A request to /api/whoami should return a JSON object with your preferred language in the language key.

  • A request to /api/whoami should return a JSON object with your software in the software key.


URL Shortener Microservice

  • You can POST a URL to /api/shorturl and get a JSON response with original_url and short_url properties. Here's an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}

  • When you visit /api/shorturl/short_url>, you will be redirected to the original URL.

  • If you pass an invalid URL that doesn't follow the valid http://www.example.com format, the JSON response will contain { error: 'invalid url' }


Exercise Tracker

  • You can POST to /api/users with form data username to create a new user.

  • The returned response from POST /api/users with form data username will be an object with username and _id properties.

  • You can make a GET request to /api/users to get a list of all users.

  • The GET request to /api/users returns an array.

  • Each element in the array returned from GET /api/users is an object literal containing a user's username and _id.

  • You can POST to /api/users/:_id/exercises with form data description, duration, and optionally date. If no date is supplied, the current date will be used.

  • The response returned from POST /api/users/:_id/exercises will be the user object with the exercise fields added.

  • You can make a GET request to /api/users/:_id/logs to retrieve a full exercise log of any user.

  • A request to a user's log GET /api/users/:_id/logs returns a user object with a count property representing the number of exercises that belong to that user.

  • A GET request to /api/users/:_id/logs will return the user object with a log array of all the exercises added.

  • Each item in the log array that is returned from GET /api/users/:_id/logs is an object that should have a description, duration, and date properties.

  • The description property of any object in the log array that is returned from GET /api/users/:_id/logs should be a string.

  • The duration property of any object in the log array that is returned from GET /api/users/:_id/logs should be a number.

  • The date property of any object in the log array that is returned from GET /api/users/:_id/logs should be a string. Use the dateString format of the Date API.

  • You can add from, to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back.


File Metadata Microservice

  • You can submit a form that includes a file upload.

  • The form file input field has the name attribute set to file.

  • When you submit a file, you receive the file name, type, and size in bytes within the JSON response.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published