Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
awy2是一个使用NodeJS开发的Web框架,基于async/await关键字, awy2是基于HTTP/2模块开发的Web框架,不支持HTTP/1.1,如果需要使用HTTP/1.1可以使用awy。
awy2和awy接口是一致的,在基本的使用上没有区别,只是支持协议不同。
const awy = require('awy2');
var ar = new awy();
ar.config.https_on = true;
ar.config.https_options.cert = '../rsa/localhost-cert.pem';
ar.config.https_options.key = '../rsa/localhost-privkey.pem';
/*
一定要注意的是:
回调函数要写成async rr的形式。
rr是打包了request和response的对象:
{
req,
res
}
*/
ar.get('/', async rr => {
rr.res.Body = 'success';
});
ar.run('localhost', 8080);
curl 'http://localhost:8080/'
输出结果:
success
const awy = require('awy2');
var ar = new awy();
ar.config.https_on = true;
ar.config.https_options.cert = '../rsa/localhost-cert.pem';
ar.config.https_options.key = '../rsa/localhost-privkey.pem';
ar.get('/test', async rr => {
var {name} = rr.req.Param;
console.log(name);
rr.res.Body = name;
});
ar.run('localhost', 8080);
curl 'http://localhost:8080/test?name=helo'
输出结果:
helo
const awy = require('awy');
var ar = new awy();
ar.config.https_on = true;
ar.config.https_options.cert = '../rsa/localhost-cert.pem';
ar.config.https_options.key = '../rsa/localhost-privkey.pem';
ar.post('/pt', async rr => {
var {username} = rr.req.BodyParam;
rr.res.Body = username;
});
ar.run('localhost', 8080);
curl 'http://localhost:8080/pt' -d 'username=albert'
返回结果:
albert
FAQs
simple,small web framework
The npm package awy2 receives a total of 0 weekly downloads. As such, awy2 popularity was classified as not popular.
We found that awy2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.