Skip to content

Commit

Permalink
add a JSON API example
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Jun 14, 2024
1 parent aa7676b commit 8a3f08c
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 3 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
registration
register

WAAdmin register: self at: 'examples/jsonapi'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
json api
getClass: aClassName

<get>
<path: '/classes/{className}'>
<produces: 'application/json'>

^ WAJsonCanvas builder render: [ :json |
json array: [
Smalltalk allClasses do:[ :class |
json object: [
json
key: 'name' value: class name;
key: 'package' value: class package name ] ] ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
json api
getClasses

<get>
<path: '/classes/'>
<produces: 'application/json'>

^ WAJsonCanvas builder render: [ :json |
json array: [
Smalltalk allClasses do:[ :class |
json object: [
json
key: 'name' value: class name;
key: 'package' value: class package name ] ] ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
json api
getPackages

<get>
<path: '/packages/'>
<produces: 'application/json'>

^ WAJsonCanvas builder render: [ :json |
json array: [
Smalltalk packages do:[ :package |
json object: [
json
key: 'name' value: package name;
key: 'classes' value: [ json render: (package classes collect: [ :class | class name ]) ] ] ] ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "WARestfulHandler",
"category" : "Seaside-REST-Examples",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "WAJsonAPIExample",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-REST-Examples'!
self packageOrganizer ensurePackage: #'Seaside-REST-Examples' withTags: #()!

This file was deleted.

0 comments on commit 8a3f08c

Please sign in to comment.