Guestbook
This exercise is an introduction to HTML Forms, RESTful-resources, and a stepping stone towards transmitting/saving/accessing data that is made available by a server.
Your Task
- Create a web form in the file:
public/guestbook-form.html
- The form will be created with Javascript, no HTML code!
- The form will send data(POST) to the address:
localhost:3000/guestbook
. - No messages are being loaded when the
index.html
page is accessed. Fix it by using XHR!
After sending the data the server will send you a JSON representation of the message you wanted to create. You may now navigate back to localhost:3000/
to see how your guestbook has been updated!
Getting Started
Set-up
- Fork this repository and clone it from your personal GitHub Account
- In the Terminal, navigate to the newly created folder for this repository
- Install dependencies by running the command:
npm install
- Install Json-Server via NPM, and globally, with the command:
npm install -g json-server
Workflow
- Run the command:
json-server server/guestbook.json
- Navigate to
localhost:3000
in your web browser - the javascript for the
index.html
file is located at:public/js/guestbook.js
- the HTML file that needs a form is located at:
localhost:3000/guestbook