restheart 基本使用
restheart 是一个方便基于mongodb的restapi 开发框架
参考项目 https://github.com/rongfengliang/restheart-docker-compose
docker-compose 环境运行
- docker-compose yaml 文件
version: '3'
networks:
backend:
services:
restheart:
image: softinstigate/restheart
container_name: restheart
depends_on:
- mongodb
networks:
- backend
ports:
- "8080:8080"
# volumes:
# - ./etc:/opt/restheart/etc:ro
mongodb:
image: mongo:3.6
container_name: restheart-mongo
environment:
MONGO_INITDB_ROOT_USERNAME: restheart
MONGO_INITDB_ROOT_PASSWORD: R3ste4rt!
command: --bind_ip_all --auth
volumes:
- ./data:/data/db
networks:
- backend
ports:
- "27017:27017"
restheart配置:
- 启动
docker-compose up -d
- 访问
http://localhost:8080/browser/#/?hal=f
基本操作
- 创建数据库
使用httpie 工具
http -a 'admin:changeit' PUT localhost:8080/db desc='this is my first db created with restheart'
HTTP/1.1 201 Created
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ETag, Auth-Token, Auth-Token-Valid-Until, Auth-Token-Location, X-Powered-By
Auth-Token: u5pxfezxze7mau2999yhjk60p4j1vnq864m5m05a711ool4x9
Auth-Token-Location: /_authtokens/admin
Auth-Token-Valid-Until: 2018-09-04T05:58:59.239Z
Content-Length: 0
Content-Type: application/json
Date: Tue, 04 Sep 2018 05:43:59 GMT
Etag: 5b8e1b9f5c404500080d1634
Keep-Alive: timeout=38
X-Powered-By: restheart.org
- 创建集合
http -a 'admin:changeit' PUT localhost:8080/db/coll desc='my first collection created with restheart'
HTTP/1.1 201 Created
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ETag, Auth-Token, Auth-Token-Valid-Until, Auth-Token-Location, X-Powered-By
Auth-Token: 148lrvqkmnl6k2mvxnoilpbv5p167xc3w7fqavbubvnsfekj3t
Auth-Token-Location: /_authtokens/admin
Auth-Token-Valid-Until: 2018-09-04T06:41:59.905Z
Content-Length: 0
Content-Type: application/json
Date: Tue, 04 Sep 2018 06:26:59 GMT
Etag: 5b8e25b35c404500080d1636
Keep-Alive: timeout=38
X-Powered-By: restheart.org
- 添加集合
http -a 'admin:changeit' POST localhost:8080/db/coll name='RESTHeart' rating='cool'
HTTP/1.1 201 Created
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ETag, Auth-Token, Auth-Token-Valid-Until, Auth-Token-Location, X-Powered-By
Auth-Token: 148lrvqkmnl6k2mvxnoilpbv5p167xc3w7fqavbubvnsfekj3t
Auth-Token-Location: /_authtokens/admin
Auth-Token-Valid-Until: 2018-09-04T06:43:40.028Z
Content-Length: 0
Content-Type: application/json
Date: Tue, 04 Sep 2018 06:28:40 GMT
Etag: 5b8e26185c404500080d1637
Keep-Alive: timeout=38
Location: http://localhost:8080/db/coll/5b8e2618c5a8c63d6b2839cd
X-Powered-By: restheart.org
- 获取集合数据
http -a 'admin:changeit' GET localhost:8080/db/coll
参考资料
https://restheart.org/learn/tutorial/
https://github.com/rongfengliang/restheart-docker-compose
restheart 基本使用的更多相关文章
- RESTheart安装与设置
作者:Maurizio Turatti, 最后在Feb 25, 2016时被 Andrea Di Cesare更新 安装与设置 1. 快速开始 Docker Vagrant Bare metal 2. ...
- RESTheart官方文档
作者:Andrea Di Cesare, Maurizio Turatti RESTHeart是SoftInstigate公司创建并开发的开源项目. MongoDB的WEB操作接口 RESTHEART ...
- Python 安装 httpie
Python 安装 httpie 前段时间开发RESTful的程序,使用浏览器插件HttpRequester,挺高级,易用的.后来在RESTHeart项目中认识了httpie,感觉高大上.在使用htt ...
- 一个方便查看数据库转换rest/graphql api 的开源软件的github 项目
https://github.com/dbohdan/automatic-api 是一个不错的github 知识项目,帮助我们 列出了,常见的的数据库可以直接转换为rest/graphql api 的 ...
- user_mongo_in_a_docker_and_dump_database
使用 mongo docker 镜像 使用 mongo 镜像是很方便的,直接使用官方镜像就好了,为了今后更方便使用,这里给出依据 restheart-docker 中的 docker-compose. ...
随机推荐
- 20170719xlVbaAbsorbProcedure
Sub AbsorbThisProcedure() If Application.VBE.MainWindow.Visible = False Then MsgBox "请先激活VBE编辑窗 ...
- 20161212xlVBA文本文件多列合并
Sub NextSeven_CodeFrame() '应用程序设置 Application.ScreenUpdating = False Application.DisplayAlerts = Fal ...
- javaScript 的 map() reduce() foreach() filter()
map(映射), reduce(规约), forEach(遍历), filter(过滤),它们都是高阶函数,都是以传入不同的函数来以不同的方式操作数组元.ie都不支持 一.map方法 *概述 map( ...
- gleez开发环境搭建
一.虚拟主机目录配置 1.配置apache服务器 Apache是常用的web服务器,即常见的用来处理http协议,处理网页的. Apache的配置文件都存放在/etc/apache2/目录,这里有很多 ...
- Authentication failed (rejected by the remote node), please check the Erlang
官网提供的解决方案 Synchronise Erlang Cookies (when running a manually installedWindows Service) Erlang Secur ...
- 简话Angular 02 Angular控制器-作用域嵌套
一句话: 就是孩子可以啃老,老子不能动孩子一根毛! * 子控制器有父控制器里变量的所有权限,可以读取,也可以修改. * 父控制器不能读,也不能修改孩子的变量 1. html代码 <div ng- ...
- mybatis标签之——<trim>
trim标记是一个格式化的标记,主要用于拼接sql的条件语句(前缀或后缀的添加或忽略),可以完成set或者是where标记的功能. trim属性主要有以下四个 prefix:前缀覆盖并增加其内容 ...
- 修改cmd窗口mysql的提示符:
mysql提示符: \D 完整的日期 \d 当前数据库 \h 服务器地址 \u 当前用户 登录数据库的时候设置提示符: mysql -uroot -proot --promp ...
- 工作中遇到的oracle分页查询问题及多表查询相关
在工作中,有时,我们会用到oracle分页查询.这时,就需要先了解oracle的rownum.rowmun是oracle的伪列,只能用符号(<.<=.!=),而不能用这些符号(>,& ...
- Mysql Innodb 表碎片整理
一.为什么会产生碎片 简单的说,删除数据必然会在数据文件中造成不连续的空白空间,而当插入数据时,这些空白空间则会被利用起来.于是造成了数据的存储位置不连续,以及物理存储顺序与理论上的排序顺序不同,这种 ...