Skip to content

WebDevCourseMaterial/MessageBoard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XMLHttpRequests

The goal of this project is to learn about making XHR requests.

The backend for this project lives at http://rose-message-board.appspot.com.

The backend stores messages. A message consist of 4 parts:

message_idUnique id of this message
google_plus_idId of the person that posted this message
(easy to fake a sender)
commentThe message body
created_date_timeWhen the message was posted

Using the backend you can create a message and add it to the datastore, get the messages, edit a message, and delete a message (standard CRUD).

Getting messages

Get 10 results: GET request to http://rose-message-board.appspot.com
Get 12 results: GET request to http://rose-message-board.appspot.com?limit=12
Get 22 results: GET request to http://rose-message-board.appspot.com?limit=20&offset=0 then...
GET request to http://rose-message-board.appspot.com?limit=20&offset=20
This will return a JSON objects that has a list of messages.

Creating a new message

POST request to http://rose-message-board.appspot.com
with a POST body {"google_plus_id": "12345", "comment": "Hello Dave"}
(returns the message that was created, 'status': 'created')
Note that the message_id and created_date_time are not sent, but set by the backend

Editing an existing message

POST request to http://rose-message-board.appspot.com
with a POST body with a message id and field to edit {"message_id": 15, "comment": "Hello David"}
(returns the message that was edited, 'status': 'updated')

Deleting a message:

POST request to http://rose-message-board.appspot.com
with a POST body with only the message id {"message_id": 15} (returns 'status': 'deleted')

About

Example of using CORS XMLHttpRequests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published