Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Getting Started Tutorial

node v14.20.1
version: 1.0.0
endpointsharetweet
const fetch = require('node-fetch') const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJoeXBlcjYzIiwiaWF0IjoxNjExMTYwMjMwLCJleHAiOjI1NTc4ODgyMzB9.HzWKLVs_cHKvCQ1l-cA2mkle63BwAD9C1Ee5-WagVDw' const url = 'https://play.hyper63.com'
await (await fetch(`${url}`)).json()
await (await fetch(`${url}/data/twilson63`, { method: 'PUT', headers: { authorization: `Bearer ${token}`}})).json()
const toId = (title, year) => `${title.replace(/\s/g,'-').toLowerCase()}-${year.toLowerCase()}` const createMovie = async (title, year) => (await fetch(`${url}/data/twilson63`, { method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: JSON.stringify({ id: toId(title, year), type: 'movie', title, year }) })).json()
await Promise.all([createMovie('Ghostbusters', '1984'), createMovie('Caddyshack', '1980'), createMovie('Groundhog Day', '1993')])
await (await fetch(`${url}/data/twilson/ghostbusters-1984`, { headers: { authorization: `Bearer ${token}` } })).json()
await (await fetch(`${url}/data/twilson/_query`, { method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: JSON.stringify({ selector: { type: 'movie' } }) })).json()
Loading…

no comments

    sign in to comment