You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow along at <https://caltechlibrary.github.io/t2t3_dataset_web_apps/presentation1.html>
36
39
37
-
You can download the presentation in a zip fil at <https://github.com/caltechlibrary/t2t3_dataset_web_apps/releases>
40
+
You can download the presentation in a zip file at <https://github.com/caltechlibrary/t2t3_dataset_web_apps/releases>
38
41
39
42
# Getting started, requirements
40
43
@@ -61,63 +64,63 @@ We can start our first iteration of our application once you have these availabl
61
64
62
65
GOAL: A simple web application that lets us curate a list of recipes.
63
66
64
-
# Part 1: What are the parts of our application?
67
+
# Part 1.1: What are the parts of our application?
65
68
66
69
1. A web service for managing the recipe collection
67
70
2. A way to browse recipes by name
68
71
3. A page to display a recipe
69
72
4. A web form for adding or edit our recipes
70
73
71
-
# Part 1: What is a recipe?
74
+
# Part 1.1: What is a recipe?
72
75
73
76
- A "key", the unique identifier of a recipe
74
77
- A name
75
78
- A list of ingredients and measures (CSV data)
76
79
- A procedure describing the preparation process (text)
77
80
78
-
# Part 1: Strategy.
81
+
# Part 1.1: Strategy.
79
82
80
83
1. Setting up our web service
81
-
2.Mock up using HTML
84
+
2.Sketch your app using HTML
82
85
3. Wire up and test
83
86
84
-
# Part 2: Setting up our web service
87
+
# Part 1.2: Setting up our web service
85
88
86
-
1. create our recipes.ds collection
87
-
2. load sample data into our recipes.ds collection
89
+
1. create our `recipes.ds` collection
90
+
2. load sample data into our `recipes.ds` collection
88
91
3. Configure and run our collection as a web service
89
92
90
-
# Part 2: creating our collection
93
+
# Part 1.2: creating our collection
91
94
92
95
We use the `dataset` command line program to initialize a dataset collection.
93
96
94
97
~~~shell
95
98
dataset init recipes.ds
96
99
~~~
97
100
98
-
# Part 2: Loading some sample data
101
+
# Part 1.2: Loading some sample data
99
102
100
103
We can now load some sample data, see [recipes.jsonl](recipes.jsonl).
101
104
102
105
~~~shell
103
106
dataset load recipes.ds <recipes.jsonl
104
107
~~~
105
108
106
-
# Part 2: create an static content directory directory
109
+
# Part 1.2: create an static content directory directory
107
110
108
111
~~~shell
109
112
mkdir htdocs
110
113
mkdir htdocs/modules
111
114
mkdir htdocs/css
112
115
~~~
113
116
114
-
# Part 2: Setting up our web service, configuring the web service
117
+
# Part 1.2: Setting up our web service, configuring the web service
115
118
116
119
`datasetd` provides a turn key web service defined by a simple YAML file. It can host
117
120
one or more dataset collections. It provides a static file service as well as a JSON API
118
121
for each collection. Let's call this [recipes_api.yaml](recipes_api.yaml).
119
122
120
-
# Part 2: Setting up our web service, configuring the web service
123
+
# Part 1.2: Setting up our web service, configuring the web service
121
124
122
125
~~~yaml
123
126
#!/usr/bin/env -S datasetd -debug
@@ -137,7 +140,7 @@ collections:
137
140
order by src->>'name'
138
141
~~~
139
142
140
-
# Part 2: Starting and stopping the web service
143
+
# Part 1.2: Starting and stopping the web service
141
144
142
145
Starting the web service.
143
146
@@ -149,11 +152,11 @@ datasetd recipes_api.yaml
149
152
- Look at the terminal window, do you see the log message for the request?
150
153
- You can shutdown the service by press control and C (Ctrl-C) in the terminal session
151
154
152
-
# Part 3: Creating our static content
155
+
# Part 1.3: Creating our static content
153
156
154
157
The web service is running but if you go to the root URL, <http://localhost:8001/>, you'll get a 404 page. We need to create HTML pages to hold the content that will be curated in our recipes application. We'll be create three HTML documents and four JavaScript modules to help with that. But before we proceed with coding let's think about what we're curating.
155
158
156
-
# Part 3: What should our recipe metadata look like?
159
+
# Part 1.3: What should our recipe metadata look like?
157
160
158
161
name
159
162
: A line of text. Held by an`input` element
@@ -166,7 +169,7 @@ procedure
166
169
167
170
We'll need a submit button to save a new or edited recipe.
0 commit comments