RESTFeel: 一个企业级的API管理&测试平台。RESTFeel帮助你设计、开发、测试您的API。
RESTFeel接口测试平台
RESTFeel接口测试平台
mvn clean install
mvn spring-boot:run
The build file is configured to download and use an embedded Tomcat server. So the application should be up and running by using just two commands mentioned above. Once the server is started, the application can be accessed using http://localhost:8080.
Default login email / password : rf@example.com / rf
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
Note : To avoid java.lang.OutOfMemoryError: PermGen space, use the following command:
MAVEN_OPTS="-XX:PermSize=256m -XX:MaxPermSize=512m" mvn spring-boot:run
Go to src/main/resources/env-development.properties and update mongodb properties. Here is how the sample configuration looks like:
mongodb.name=restfiddle
mongodb.host=localhost
mongodb.port=27017
mongodb.username=
mongodb.password=
1. Stop RESTFiddle server, if running.
2. Start MongoDB, if not running.
Here is the command I use : "C:\Program Files\MongoDB\bin\mongod.exe" --dbpath C:\Users\ANUJA\Documents\restfiddle\data
3. Connect to MongoDB.
Here is one of the ways to connect to MongoDB :
Go to "C:\Program Files\MongoDB\bin" folder and run "mongo" command.
Then run "use restfiddle" command and finally "db.dropDatabase()" command to delete the existing RESTFiddle database.
Note : you will see following message on the command prompt : { "dropped" : "restfiddle", "ok" : 1 }
4. Start RESTFiddle application (mvn spring-boot:run) - This will create and initialize the database.
Sometimes MongoDB doesn't start and shows message:
old lock file: C:\Users\ANUJA\Documents\restfiddledata\data\mongod.lock. probably means unclean shutdown
Run repair operation to recover your database
"C:\Program Files\MongoDB\bin\mongod.exe" --dbpath C:\Users\ANUJA\Documents\restfiddledata\data --repair
Most likely, your data will be repaired with the --repair option. In case it doesn't, delete the mongod.lock file and then run the above --repair command.
> use admin;
switched to db admin
> db.createUser({ user: "root",pwd: "root",customData:{name:"root"},roles:[{ role: "userAdminAnyDatabase",db: "admin" }]})
Successfully added user: {
"user" : "root",
"customData" : {
"name" : "root"
},
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
> db.auth('root','root')
1
var r =
{
"_id": "restfiddle.root",
"user": "root",
"db": "restfiddle",
"credentials": {
"SCRAM-SHA-1": {
"iterationCount": 10000,
"salt": "riZjwBYHvkcV99typ8BRMA==",
"storedKey": "E2QOruLrBNXD1mlQTX0TQogL/ws=",
"serverKey": "JEQhfa/5x7+aNzKrFvKRkctXXfQ="
}
},
"roles": [
{
"role": "dbOwner",
"db": "restfiddle"
},
{
"role": "read",
"db": "restfiddle"
},
{
"role": "readWrite",
"db": "restfiddle"
}
]
}
db.system.users.insert(r)
或者
use restfiddle
db.createUser({"user":"jason","pwd":"123456","roles":["dbOwner","read","readWrite"]})
可以看到admin中已经有了jason这个管理员:
> use admin;
> db.system.users.find();
{
"_id": "restfiddle.jason",
"user": "jason",
"db": "restfiddle",
"credentials": {
"SCRAM-SHA-1": {
"iterationCount": 10000,
"salt": "HZsutqbxGjKVkPcY4305FQ==",
"storedKey": "bynL9UW9cIf0iPOLo9pGwCFz638=",
"serverKey": "PRPKH+7dVaKDJ/JE+7ZjQUe3whA="
}
},
"roles": [
{
"role": "dbOwner",
"db": "restfiddle"
},
{
"role": "read",
"db": "restfiddle"
},
{
"role": "readWrite",
"db": "restfiddle"
}
]
}
Fetched 4 record(s) in 9ms
參考文章:
源自开源项目: RESTFiddle
An Enterprise-grade API Management Platform for Teams. RESTFiddle helps you design, develop, test and release APIs.
Some of the key features of this platform are:
A lot of powerful features coming soon!
Want to be added to this section? Email me at contact at bootsimply dot com.
Build war
Unix :
./gradlew clean war
Windows :
gradlew.bat clean war
Run
Unix :
./gradlew bootRun
Windows :
gradlew.bat bootRun
Debugging in Windows : Add the following to build.gradle file and then run the above command
applicationDefaultJvmArgs = [
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
]
Download the latest MongoDB version. After kappa release, RESTFiddle has enabled authentication and moved to version 3.0. To start using this, create a configuration file mongo.conf at a location.e.g. F:\restfiddledata. Create mongo.log file for logging e.g. F:\restfiddledata\log\ This is how configuration file looks like:
bind_ip = 127.0.0.1
port = 27017
quiet = true
dbpath=F:\restfiddledata\data0
logpath=F:\restfiddledata\log\mongo.log
logappend = true
Start MongoDB without authentication.
"C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe" --config F:\restfiddledata\mongo.conf
On another command prompt go to C:\Program Files\MongoDB\Server\3.0\bin and type command mongo. This opens Mongo Shell.
Create user here.
use restfiddle
db.createUser({"user":"rf","pwd":"rf","roles":["dbOwner","read","readWrite"]})
Now stop the database and restart it so that it checks for authentication
"C:\Program Files\MongoDB\Server\3.0\bin\mongod.exe" --auth --config F:\restfiddledata\mongo.conf
Start the RESTFiddle application using the same command as earlier
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"
You can deploy the war file to Tomcat 7.0.52, Jetty, or any other container, as long as it supports servlet 3.0.
You're interested in contributing to RESTFiddle? AWESOME. Here are the basic steps:
https://groups.google.com/forum/#!forum/restfiddle
http://www.meetup.com/RESTFiddle
https://gitter.im/AnujaK/restfiddle
https://nemo.sonarqube.org/overview?id=com.restfiddle%3Arestfiddle
https://github.com/AnujaK/restfiddle/releases
If you need help in setting up RESTFiddle for your Team/Organization, feel free to contact me at this email address.
Copyright 2015 BootSimply Solutions
Licensed under Apache License, Version 2.0