I hereby claim:
- I am hharzer on github.
- I am hrhrzr (https://keybase.io/hrhrzr) on keybase.
- I have a public key ASBv7d5YKG3DvlUvctMQQKDjXRiLkEMyuR7sy-IKLrU3iQo
To claim this, I am signing this object:
<div class="clocks"> | |
<svg viewBox="-1024 -1024 2048 2048" class="clock"> | |
<title>Swiss Railway Clock</title> | |
<style type="text/css"> | |
.bg { | |
stroke: none; | |
fill: white; | |
} | |
.fc { |
I hereby claim:
To claim this, I am signing this object:
I got sick of writing the same Serializer & ModelViewSet classes over and over so I found and wrote some code to do it for me, and somehow it works! Please note that there are a lot of caveats to running an API like this and while this may work, I know there's A LOT of room for improvement, feel free to fork and help!
Import the router
module to your main sites urls.py file as the injection point like so...
Make sure to remove any other imports from other viewsets that you don't need that may conflict!
<div class="grid"> | |
<div class="grid__row"> | |
<div class="grid__col grid__col--4"> | |
<textarea class="js-input"># An exhibit of Markdown | |
This note demonstrates some of what [Markdown][1] is capable of doing. | |
*Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.* |
### Keybase proof | |
I hereby claim: | |
* I am hharzer on github. | |
* I am hrhrzr (https://keybase.io/hrhrzr) on keybase. | |
* I have a public key ASBzusxzsKqjsj-EL4Hs0qzJXnZm1B29YOcok9VdsLJ38Qo | |
To claim this, I am signing this object: |
When the FaunaDB JavaScript driver returns query results, it's exposing the the response payload, but not the response headers. However, the response headers contain query metrics you might want (e.g., read ops, write ops, transaction retires, query time, bytes in/out, storage bytes read/written, read ops).
The web shell/REPL at dashboard.fauna.com also presents this information to you through the GUI (click the "i" on left).
Here are some examples to help you get the repsonse headers
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms)); | |
// or | |
// const baseQuery = q.Paginate(q.Collection(collectionName)) | |
const expandedQuery = q.Map(baseQuery, (ref) => | |
q.Let( | |
{ | |
instance: q.Get(q.Var('ref')) | |
}, | |
{ |
const router = require('./router'); | |
router.setRoutes([ | |
{ | |
path: '/ping', | |
method: 'GET', | |
handler: ping | |
}, | |
{ | |
path: '/hello/:name', |
{ | |
"_id": "_design/lookup", | |
"_rev": "2-2763d098bce604230bfc247ca06cba05", | |
"language": "javascript", | |
"indexes": { | |
"all": { | |
"index": "function(doc) {\n if (doc.title)\n {\n index(\"title\", doc.title, {\"store\": \"yes\"});\n }\n }" | |
} | |
} | |
} |