The Flexigift service can run in the cloud, but code samples and tutorials in API documents assume you are running Flexigift from you local workstation.
The Flexigift service requires the following utilities:
Log in to the Flexigift GitHub repo.
Click Fork in the upper-right portion of the screen:
From your GitHub fork, copy the repo’s SSH URL to your clipboard:
In a terminal on your computer, change to your Git working folder. ex:
cd ~/githome
Clone your fork of the Flexigift repo. ex:
git clone git@github.com:<your-git-account>/flexigift-service.git
Move to your new Flexigift directory. ex:
cd flexigift-service
Create and check out a test branch. ex:
git checkout -b flexigift-test
Test your Flexigift instance:
cd api
json-server -w Flexigift.json
If your system is set up properly, Flexigift starts up. ex:
\{^_^}/ hi!
Loading Flexigift.json
Done
Resources
http://localhost:3000/users
http://localhost:3000/gift_cards
http://localhost:3000/products
http://localhost:3000/transactions
Home
http://localhost:3000
Note: Leave the Flexigift console open! Keep this window open to run Flexigift and open another window to make API calls.
Open a new console window and make a test call to the service. ex:
curl http://localhost:3000/users
If the service is running correctly, you will see a list of users from the service. ex:
[
{
"id": 1,
"user_id": "user001",
"amazon_id": "amz12345",
"name": "John Doe",
"email": "john.doe@example.com",
"gift_cards": [
"hanes-gc-001",
"nike-gc-002"
]
},
{
"id": 2,
"user_id": "user002",
"amazon_id": "amz67890",
"name": "Jane Smith",
"email": "jane.smith@example.com",
"gift_cards": [
"starbucks-gc-003"
]
},
{
"id": 3,
"user_id": "user003",
"amazon_id": "amz54321",
"name": "Alice Johnson",
"email": "alice.johnson@example.com",
"gift_cards": [
"gap-gc-004",
"nike-gc-002"
]
},
{
"id": 4,
"user_id": "user004",
"amazon_id": "amz98765",
"name": "Bob Brown",
"email": "bob.brown@example.com",
"gift_cards": [
"hanes-gc-001"
]
}
]
If you don’t see the list of users, or receive an error in any step of the procedure, investigate and correct the error before continuing.
Some common situations that cause errors include:
If you see the list of users from the service, congratulations! You are ready to use Flexigift. Start with the following links: