elemefe / restc Goto Github PK
View Code? Open in Web Editor NEWA server-side middleware to visualize REST requests.
Home Page: https://elemefe.github.io/restc/
License: MIT License
A server-side middleware to visualize REST requests.
Home Page: https://elemefe.github.io/restc/
License: MIT License
Like this:
// import restc
const restc = require('restc');
// use restc middleware
app.use(restc({only: ['/api'], except: ['/web']}).express());
必须
Accept: application/json, /
Accept: application/vnd.github.v3+json
两个都写,不然会报错
虽然并不影响正常运行,但能否实现支持
写入 res.set('Content-Type', 'application/octet-stream')后
postman没问题,浏览器打开,直接下载一个文件后缀为dms
静态文件使用没问题,但是用模版引擎渲染一些html而不是json接口时,依然会走restc的服务,这个时候怎么强制输出html?
对于返回数据比较复杂的接口,折叠功能会更加方便让开发者进行调试。
Nodejs v10 http response status code default value is 404
webpack middleware与restc搭配一起运行,restc打开接口地址,直接提示下载,无法显示页面,response返回的content type 并不是txt/html 。
后面直接修改源代码,重新设定了响应的类型,之后正常
server {
listen 8000;
root /home/restc;
index index.php index.html index.htm;
location / {
add_header Vary Accept;
if ($http_accept ~* "text/html") {
rewrite ^.*$ / break;
proxy_pass https://restc.faas.ele.me;
}
}
include enable-php.conf;
}
echo '{"hello":"json"}';
请问文档用什么工具写的,界面好舒服
Hapi has official project similar like your project, https://github.com/hapijs/tv , Both are awesome!
本地环境wamp ,文档只说了Nginx 没说apache,另外xml格式的响应支持吗?
Currently, restc only recognizes the following form of Content-Disposition
:
Content-Disposition: ...; filename="foo.bar"
Thus, the filenames of some attachments may be unexpectedly dropped.
For example, if the response header contains:
Vary: foo
Vary: bar
restc will transform it into:
Vary: foo, bar
However, the two Vary
s should not be combined here.
Since getAll()
is deprecated and get()
returns a combined string instead of an array, this issue may be not easy to solve.
400.1 无匹配的主机名,页面出不来
今天第一次用,发现页面也成为了 restc 的页面, 所以有没有一些选项能让我指定只针对某些规则的 url . 或者其他的方式可以绕过不应该转变为 restc 的页面
我目前是这么做的:
if (DEVELOPMENT) {
app.use(async (ctx, next) => {
if (ctx.url.indexOf('/api') !== -1) {
return restc.koa2()(ctx, next)
}
return next()
})
}
In version 0.2.0, files not found at
https://github.elemecdn.com/highlightjs/
中文文档指南(文档正文,非目录)中,直接跳转至Nginx配置有问题。:smile:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.