Coder Social home page Coder Social logo

chirouter's Introduction

Consuming the API

This API allows you to create, read, update, and delete students. Here are some examples of how to use curl to interact with the API endpoints:

Creating a student

To create a student, send a POST request to the / endpoint with a JSON body containing the student's name and study field:

curl -X POST \
  http://localhost:8080/ \
  -H 'Content-Type: application/json' \
  -d '{
	"name": "Alice",
	"study": "Computer Science"
}'

Reading a student

To read a student, send a GET request to the /get/{name} endpoint, where {name} is the name of the student you want to read:

curl -X GET http://localhost:8080/get/Alice 

Updating a student

To update a student, send a PUT request to the /update/{name} endpoint with a JSON body containing the updated student information. The {name} parameter in the endpoint should be the name of the student you want to update:

curl -X PUT \
  http://localhost:8080/update/Alice \
  -H 'Content-Type: application/json' \
  -d '{
	"name": "Alice",
	"study": "Mathematics"
}'

Deleting a student

To delete a student, send a DELETE request to the /delete/{name} endpoint, where {name} is the name of the student you want to delete:

curl -X DELETE http://localhost:8080/delete/Alice

Note that these are just examples, and you may need to modify the curl requests depending on your specific use case.

chirouter's People

Contributors

goodylili avatar

Stargazers

Roman avatar Nelson Isioma avatar

Watchers

 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.