GithubHelp home page GithubHelp logo

angomablaise / advanced-first-web-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from austincodingacademy/advanced-first-web-server

0.0 1.0 0.0 57 KB

A starter repo for the ACA Advanced `My First Web Server` project.

JavaScript 100.00%

advanced-first-web-server's Introduction

My First Web Server

A starter repo for the ACA Advanced My First Web Server project.

Part 1.

  • Give your server the ability to respond to a GET request with a path "/users" and return the users array from state.js
  • Give your server the ability to respond to a GET request with a path "/users/1" and return the first user object from the users array from state.js
  • Give your server the ability to respond to a POST request with a path "/users" and just add a hard coded user object to the users array from state.js. .json() the last user in the array to send it back to the client. (if you do another GET request you should see this added)
  • Give your server the ability to respond to a PUT request with a path "/users/1" and just change any key value on the first user object in the users array in state.js. .json() this user to send it back to the client.
  • Give your server the ability to respond to a DELETE request with a path "/users/1" and remove one item from the users array. send() back a messsage "deleted"

Part 2. Use the express built in REST methods to do the same thing as Part 1

  • Give your server the ability to respond to a GET request with a path "/users" and return the users array from state.js
  • Give your server the ability to respond to a GET request with a path "/users/1" and return the first user object from the users array from state.js
  • Give your server the ability to respond to a POST request with a path "/users" and just add a hard coded user object to the users array from state.js. .json() the last user in the array to send it back to the client. (if you do another GET request you should see this added)
  • Give your server the ability to respond to a PUT request with a path "/users/1" and just change any key value on the first user object in the users array in state.js. .json() this user to send it back to the client.
  • Give your server the ability to respond to a DELETE request with a path "/users/1" and remove one item from the users array. send() back a messsage "deleted"

Part 3. Add the body-parser module to your project

  • Give your server the ability to handle a POST request with a path "/users" and add the data from the client to the users array
  • Assign an _id property to the user object that is a number that increments by 1 each time.
  • response.json() the user object to send it back to the client. (if you do another GET request you should see this added)

Part 4. Use path variables

  • Give your server the ability to respond to a GET request with a path /users/:userId and return the user object from the users array that has the _id == userId
  • Give your server the ability to respond to a PUT request with a path /users/:userId and just change any key value on the user object with this _id
  • Give your server the ability to respond to a DELETE request with a path /users/:userId and find the user with this id from the array. give this user object a new key value isActive:false. send() back a messsage "deleted"

advanced-first-web-server's People

Contributors

jw56578 avatar canaandavis avatar ivome avatar

Watchers

James Cloos 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.