Skip to content

liweitian/MPCS52554-hw3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

You can use the startServer script to complete step 1 and 2. 
./startServer.sh

Note, sometimes the python server may start before the rails server finish booting.
Hence, if you failed to import js code in rails server, please following step 1 and 2 to start the server side and client side 

1. please start the rails server on hw3 using rails server. By default, it is on localhost:3000.

2. Using python -m SimpleHTTPServer to start client side on client.html.
By default, it is on localhost:8000.


3. For the given 4 API functions. I provide sendRequest('AB123',1) and w.addNewItem('AB123',1) for you to easily test my program.

I suggest you to test following this manner. 
We do not provide too much data in database at this time. You can use the given function to test or using curl. See below:

Go to localhost:8000/client.html and open the console. Input the following commands.

1:var w = new WareHouse('bGxsamdsd3Q=')

console.log(w)

2:w.getAllItemsOfSeller()
w.data

You can also use curl to test 2 for example,
curl -i localhost:3000/api/inventory?apiKey=bGxsamdsd3Q=

3:w.getAnItemDetail('AB123')
w.data

You can also use curl to test 3 for example,
curl -i localhost:3000/api/inventory/AB123?apiKey=bGxsamdsd3Q=

4:w.sendRequest('AB123',1)
w.response

4: You can also use curl to test 4 for example,
curl -d 'apiKey=bGxsamdsd3Q=&quantity=1&sku=AB123' 'localhost:3000/api/orders'

5:w.addNewItem('AB123',1)
w.response

5: You can also use curl to test 5 for example, 
curl -d 'apiKey=bGxsamdsd3Q=&quantity=1&sku=AB123' 'localhost:3000/api/inventory'


If you sign up your own account, please choose abc1 as your seller. Again, I do not provide much data on the database at this time.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published