Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Fix next steps (#1) #28

Merged
merged 2 commits into from Apr 5, 2018
Merged

Fix next steps (#1) #28

merged 2 commits into from Apr 5, 2018

Conversation

Andrew-Lees11
Copy link
Contributor

These changes Update:
AddWebApplication.md
DeployToCloud.md
RetrievingAndDeleting.md
To work with the updated FoodTracker README with PostgreSQL.

It also has changes to the README to add a Summary route which only displays the meal name and rating so users can see the meals without the pages of photo data.

Finally there are some minor text changes for clarity.

* add postgre to DeployToCloud

* update AddWebApplication for postgre

* add complete message to stencil

* first draft README update

* Update RetrievingAndDeleting for postgres

* added summary to meal

* Fixed bugs in tutorials
This was referenced Apr 3, 2018
README.md Outdated
-H 'content-type: application/json'
```
This should now return an array containing the Meals that was stored by the POST request. As this contains the full images stored in the Meal objects, this will involve several screens of data!
This should now return an array containing the meals names and ratings stored by the POST request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be spelled meals' names and ratings

README.md Outdated
```
below the line `.package(url:
"https://github.com/IBM-Swift/Health.git", from: "0.0.0"),`
below the line `.package(url: "https://github.com/IBM-Swift/Health.git", from: "0.0.0"),`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are finding out right now, this should be specifying at least version 1.0.0

@@ -330,7 +334,7 @@ router.post("/foodtracker") { request, response, next in
}
```

Restart your server to add your new changes. When you add a new meal at [http://localhost:8080/foodtracker](http://localhost:8080/foodtracker), you should see the webpage update with your new meal.
Restart your server to add your new changes. When you add a new meal at [http://localhost:8080/foodtracker](http://localhost:8080/foodtracker), you should see the webpage update with your new meal. Since the requests are Asyc, you may need to refresh the webpage to see the new meal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Since the requests are async...

@@ -150,8 +150,12 @@ router.get("/foodtracker") { request, response, next in
```
We can test this route by running the FoodTracker application and the FoodServer. Add a meal in the app and then go to [http://localhost:8080/foodtracker](http://localhost:8080/foodtracker). This will now display a line saying how many meals are present in the app and a list of the meal names and ratings.

### Congratulations, you have successfully served a dynamic HTML webpage!
The next sections will take you through saving and displaying the meal photograph, receiving new meals from a web form and adding css to the webpage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS should be all caps.


2. The following code can be used in the FoodTracker app to make the call to the FoodServer. Here the Meal name is used for the Identifier.
3. The following function is added to the FoodTracker > MealTableViewController to make the delete call to the FoodServer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just specify the filename here, like MealTableViewController.swift instead of the hierarchy you used here.


2. The following code can be used in the FoodTracker app to make the call to the FoodServer. Here the Meal name is used for the Identifier.
3. The following function is added to the FoodTracker > MealTableViewController to make the delete call to the FoodServer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, delete should be in all caps here to specify the RESTful call being made.

```swift
do {
let data = try PropertyListEncoder().encode(meals)
let isSuccessfulSave = NSKeyedArchiver.archiveRootObject(data, toFile: MealTableViewController.ArchiveURL.path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for now, but perhaps setting up Core Data, or even using something like Realm, might be better in the future 😄 just for the sake of "best practices" on the iOS side. This is an old school way of doing it.

The following code can be added to the FoodTracker app and will query the saved Meals from the server, and update the TableView:
1. Open the FoodTracker workspace
`open ~/FoodTrackerBackend/iOS/FoodTracker/FoodTracker.xcworkspace/`
2. In FoodTracker > MealTableViewController.swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is incomplete. Maybe 2 and 3 need to be merged together?

README.md Outdated
func summaryHandler(completion: @escaping ([Summary]?, RequestError?) -> Void ) {
Meal.findAll { meals, error in
if let meals = meals {
completion(Summary(meals), nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have error handling, and will hang forever if meals doesn't resolve properly.

Copy link
Contributor

@dokun1 dokun1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@seabaylea
Copy link
Member

LGTM. Merging.

@seabaylea seabaylea merged commit 4a1de7d into IBM:master Apr 5, 2018
seabaylea pushed a commit that referenced this pull request Sep 12, 2018
* Add Persistence Tutorial (#14)

* Add Database tutorial

* linked to CompletedFoodTracker

* fixed missing bracket

* Fixed missing space

* removed no requisites

* remove -> void

* no festive :(

* update README

* README review

* feat: Add ORM with PostgreSQL steps (#18)

* Meal.swift file no longer changed (#20)

* Updated to keep model object same

* Minor edits

* One word change

* Added Tutorial for Stencil Templating (#16)

* add Stencil Tutorial

* fixing typos

* Little fixes

* added Form Submission

* Stencil updates

* fixed new lines

* kye review

* Editing updates to StencilFrontend tutorial

* implemented Helens changes

* remove w3 css

* made new Example.stencil

* update readme

* Fixed README for Web and ORM (#22)

* Updated to keep model object same

* Minor edits

* One word change

* Updated web templating front end to use ORM functionality

* Removed configuration target when adding ORM

* Changes suggested by @ianpartridge

* One last minor change

* Updated per @Andrew-Lees11 comments

* Update food tracker backend (#27)

* Update Foodtracker tutorial

* update targets

* Fix next steps (#1) (#28)

* Fix next steps (#1)

* add postgre to DeployToCloud

* update AddWebApplication for postgre

* add complete message to stencil

* first draft README update

* Update RetrievingAndDeleting for postgres

* added summary to meal

* Fixed bugs in tutorials

* implemented Davids review

* Remove build warnings in xcode Swift 4.1 (#31)

* Fix numbers (#32)

* fix: numbering in README

* fix: add full stop

* feat: Update Swift-Kuery-ORM version (#33)

* Complete FoodTracker tutorial

* linked Auth in next steps

* update to Kitura 2.5

* added basc authentication steps

* removed database next step
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants