forked from extern/bruno
feat: moved bruno testbench into packages/ (feat: resolves #17)
This commit is contained in:
parent
64bffc8216
commit
2ac1b3639d
104
packages/bruno-testbench/.gitignore
vendored
Normal file
104
packages/bruno-testbench/.gitignore
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
1
packages/bruno-testbench/config/default.yml
Normal file
1
packages/bruno-testbench/config/default.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
port: 6000
|
1464
packages/bruno-testbench/package-lock.json
generated
Normal file
1464
packages/bruno-testbench/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
31
packages/bruno-testbench/package.json
Normal file
31
packages/bruno-testbench/package.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "@usebruno/testbench",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node .",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/usebruno/bruno"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/usebruno/bruno/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/usebruno/bruno",
|
||||||
|
"dependencies": {
|
||||||
|
"body-parser": "^1.20.0",
|
||||||
|
"config": "^3.3.8",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"express": "^4.18.1",
|
||||||
|
"express-xml-bodyparser": "^0.3.0",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"multer": "^1.4.5-lts.1"
|
||||||
|
}
|
||||||
|
}
|
6
packages/bruno-testbench/readme.md
Normal file
6
packages/bruno-testbench/readme.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# bruno-testbench
|
||||||
|
|
||||||
|
A simple expressjs server that I use to test bruno.
|
||||||
|
|
||||||
|
### License
|
||||||
|
[MIT](LICENSE)
|
52
packages/bruno-testbench/src/index.js
Normal file
52
packages/bruno-testbench/src/index.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
const xmlparser = require('express-xml-bodyparser');
|
||||||
|
const cors = require('cors');
|
||||||
|
const config = require('config');
|
||||||
|
const multer = require('multer');
|
||||||
|
|
||||||
|
const app = new express();
|
||||||
|
const port = config.port;
|
||||||
|
const upload = multer();
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.use(xmlparser());
|
||||||
|
app.use(bodyParser.text());
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
app.use(bodyParser.urlencoded({extended: true}));
|
||||||
|
|
||||||
|
app.get("/ping", function(req, res) {
|
||||||
|
return res.send("pong");
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/headers", function(req, res) {
|
||||||
|
return res.json(req.headers);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/query", function(req, res) {
|
||||||
|
return res.json(req.query);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/echo/json", function(req, res) {
|
||||||
|
return res.json({ping: "pong"});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/echo/json", function(req, res) {
|
||||||
|
return res.json(req.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/echo/text", function(req, res) {
|
||||||
|
return res.send(req.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/echo/xml", function(req, res) {
|
||||||
|
return res.send(req.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/echo/multipartForm", upload.none(), function(req, res) {
|
||||||
|
return res.json(req.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(port, function() {
|
||||||
|
console.log(`Testbench started on port: ${port}`);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user