Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions example/nodejs/DEVNOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

```bash
sudo docker-compose run app
```
5 changes: 5 additions & 0 deletions example/nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:11.3-alpine

WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
11 changes: 11 additions & 0 deletions example/nodejs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '2'

services:
app:
build: .
command: node --es_staging --experimental-modules ./src/test1.mjs
environment:
KINTO_URL: https://kinto.codeformuenster.org/v1
# NODE_OPTIONS set CLI options in the environment via a space-separated list
volumes:
- ./src:/usr/src/app/src
6 changes: 6 additions & 0 deletions example/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"kinto-http": "4.6.1"
}
}
12 changes: 12 additions & 0 deletions example/nodejs/src/test1.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import KintoClient from "kinto-http";

const kintoUrl = process.env.KINTO_URL
const client = new KintoClient(kintoUrl);

// const info = await client.fetchServerInfo([options]);
const info = await client.fetchServerInfo();

// const result = await client.createBucket("blog");


console.log(info)
5 changes: 5 additions & 0 deletions example/python/DEVNOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

```bash
cat ./secrets/KINTO_PASSWORD | read -x KINTO_PASSWORD
sudo --preserve-env docker-compose run -e KINTO_PASSWORD app python test1.py
```
5 changes: 5 additions & 0 deletions example/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.7-alpine3.8

WORKDIR /usr/src/app
COPY requirements.txt /usr/src/app/
RUN pip install -r requirements.txt
12 changes: 12 additions & 0 deletions example/python/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
app:
build: .
command: python ./test1.py
environment:
KINTO_URL: https://kinto.codeformuenster.org/v1
KINTO_USER: admin
KINTO_PASSWORD:
volumes:
- .:/usr/src/app
1 change: 1 addition & 0 deletions example/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kinto-http~=10.1.1
16 changes: 16 additions & 0 deletions example/python/test1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from kinto_http import Client

kinto_url = os.getenv('KINTO_URL', 'http://localhost:8888/v1')
kinto_user = os.getenv('KINTO_USER', 'admin')
kinto_password = os.getenv('KINTO_PASSWORD', 'admin')

client = Client(server_url=kinto_url,
auth=(kinto_user, kinto_password))

records = client.get_records(bucket='default', collection='todos')
for i, record in enumerate(records):
record['title'] = 'Todo {}'.format(i)

for record in records:
client.update_record(record)