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 基本使用的更多相关文章

  1. RESTheart安装与设置

    作者:Maurizio Turatti, 最后在Feb 25, 2016时被 Andrea Di Cesare更新 安装与设置 1. 快速开始 Docker Vagrant Bare metal 2. ...

  2. RESTheart官方文档

    作者:Andrea Di Cesare, Maurizio Turatti RESTHeart是SoftInstigate公司创建并开发的开源项目. MongoDB的WEB操作接口 RESTHEART ...

  3. Python 安装 httpie

    Python 安装 httpie 前段时间开发RESTful的程序,使用浏览器插件HttpRequester,挺高级,易用的.后来在RESTHeart项目中认识了httpie,感觉高大上.在使用htt ...

  4. 一个方便查看数据库转换rest/graphql api 的开源软件的github 项目

    https://github.com/dbohdan/automatic-api 是一个不错的github 知识项目,帮助我们 列出了,常见的的数据库可以直接转换为rest/graphql api 的 ...

  5. user_mongo_in_a_docker_and_dump_database

    使用 mongo docker 镜像 使用 mongo 镜像是很方便的,直接使用官方镜像就好了,为了今后更方便使用,这里给出依据 restheart-docker 中的 docker-compose. ...

随机推荐

  1. 最短路-Prim算法 dijkstra算法

    HDU-1233 #include <iostream> #define INF 1000000 using namespace std; ][]; ]; ]; ]; ]; int mai ...

  2. Java开发常用Util工具类-StringUtil、CastUtil、CollectionUtil、ArrayUtil、PropsUtil

    字符串工具类 StringUtil.java package com.***.util; /** * StringUtil * @description: 字符串工具类 **/ public clas ...

  3. Liebig's Barrels CodeForces - 985C (贪心)

    链接 大意:给定$nk$块木板, 要制作$n$个$k$块板的桶, 要求任意两桶容积差不超过$l$, 每个桶的容积为最短木板长, 输出$n$个桶的最大容积和 假设最短板长$m$, 显然最后桶的体积都在$ ...

  4. Unity3D中的函数方法和解释

    一.刷新函数 Update 当MonoBehaviour启用时,其Update在每一帧被调用. LateUpdate 当Behaviour启用时,其LateUpdate在每一帧被调用. FixedUp ...

  5. 如何用xmlspy将xml文档生成xsd文件

    所以我们有必要知道如何通过xmlspy这个非常方便的工具进行xml的转换工作.点击“File”-“New”系统会弹出“create new document”的窗口,此时选择“xml XML docu ...

  6. 用POI导出excel时,较长的数字不想被自动变为科学计数法的解决方式(转)

    做过很多次导出excel了.都碰到一个问题,内容里如果包含一个比较长的数字,比如订单号“2546541656596”,excel会自动变成科学计数法... 弄过好几次都没有解决,最近又要导出excel ...

  7. gdb调试分析多线程死锁

    转载: http://blog.chinaunix.net/uid-30343738-id-5757210.html #include <stdio.h> #include <pth ...

  8. mysql添加伪劣及查看表信息

    SELECT @rownum:=@rownum+1 AS rownum, table_name.* FROM (SELECT @rownum:=0) r, table_name     select ...

  9. Unity5.2如何使用VS调试

    今天不想使用Mono了,想用VS调试Unity,上百度搜了很久无果,VPN又连不上,结果搞两个小时没搞定.11点终于可以上谷歌了,十分钟搞定.由此可见,百度真的很坑爹...废话不多说下面上正文. 误区 ...

  10. C#:String.Format数字格式化输出 {0:N2} {0:D2} {0:C2}...

    int a = 12345678; //格式为sring输出//   Label1.Text = string.Format("asdfadsf{0}adsfasdf",a);// ...