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. ...
随机推荐
- python-day8-赋值
# x=10 #链式赋值# a=b=c=d=e=f=10# print(a,b,c,d,e,f) #增量赋值 # x=10# y='a'# temp=x# x=y# y=temp# print(x,y ...
- 生成图片验证码(.NET)
一.生成随机字符串 方法一: public string CreateRandomCode(int codeCount) { string allChar = "0,1,2,3,4,5,6, ...
- 使用UTL_SMTP发送中文邮件及使用UTL_TCP从附件服务器获取中文附件
先上最重要的干货 发送邮件正文及主题的时候一定要使用convert重新编码 主题: utl_smtp.write_raw_data(l_mail_conn, utl_raw.cast_to_raw(c ...
- Windows系统下修改Erlang默认路径
新建.erlang文件: io:format("consulting .erlang in ~p~n",[element(2, file:get_cwd())]). c:cd(&q ...
- 改变进程的优先级,nice,getpriority,setpriority
int getpriority(int which, int who);返回一组进程的优先级 参数which和who确定返回哪一组进程的优先级 The value which is one of PR ...
- System.out.println(i++); System.out.println(++i);的区别
之前一直对i++和++i很模糊,这次通过两个小demo来探究下. 例1: public static void main(String[] args) { int i=2; System.out.pr ...
- Mysql/Mariadb 升级注意事项
因需要使用到分区表,在业务不中断的情况下,可以新增分区,需要将原来的Mariadb10.1.25版本升级到Mariadb10.3.8. 1.升级步骤如下 1)新搭建Mariadb10.3.8版本的DB ...
- docker 部署 flask(一)配置环境及测试
简介: flask也是要部署的.不能老在我们的pycharm里面跑测试服务器. 各种配置linux,我看就算了吧.我们用docker部署. 也就两三行命令. 一:选择基础镜像 GitHub repo: ...
- UML(统一的建模语言)
1.软件开发与软件工程 任何事情都必须想清楚了,才能去做!这样才不会出现很多不必要的麻烦,软件开发亦是如此. 写代码前要想好:想要做什么?做成什么样?如何去做? 软件设计就是把软件开发想清楚的过程: ...
- SharePoint BDC(Business Data Connectivity)服务-PowerShell
1. 获取BCS服务应用程序的标识 Get-SPServiceApplication 2. 获取指定的BCS服务应用程序实例 $bcs = Get-SPServiceApplication -Iden ...