Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@fibjs/fibx-router
Advanced tools
npm install @fibjs/fibx-router
npm install --save-dev
npm test
var app = require('fibjs-fibx')();
var route = require('fibjs-fibx-router')({
fixSlash: true,
simulation: true,
size: 200
});
/** all 提供各个路由的统一执行体, 不提供路由能力 **/
route.all('/rube', function(next) {
next('rube-dong');
});
route.get('/rube', function(p){
this.body = p;
});
route.post('/rube', function(p){
this.body = p;
});
route.get('/hello', function() {
this.body = 'hello world';
});
route.get('/show/:name', function() {
this.body = 'hello world ---' + this.params.name;
});
route.post('/show/:name', function() {
this.body = 'hello world ---' + this.params.name;
});
app.use(function(next) {
try {
next();
} catch (e) {
this.body = 'error';
}
});
app.use('/', route.getAllRoute());
console.log('you can open browser, input 127.0.0.1:7759/hello and more~');
app.listen(7759);
如果你想写一个 fibjs 模块上传到 npm,必须像本项目在目录下放如 fibjs-install.js 的文件.
var fs = require('fs');
var os = require('os');
var process = require('process');
var modulesPath = '../../.modules';
var moduleName = JSON.parse(fs.readFile('package.json').toString()).name;
var isExists = fs.exists(modulesPath);
!isExists && fs.mkdir(modulesPath);
switch (os.type) {
case 'Darwin':
process.exec('ln -s ../node_modules/' + moduleName + ' ' + modulesPath + '/' + moduleName);
break;
default :
process.exec('ln -s ../node_modules/' + moduleName + ' ' + modulesPath + '/' + moduleName);
}
然后在 package.json 中添加
"scripts": {
"install": "fibjs fibjs-install.js",
}
FAQs
fibx router middlewave
The npm package @fibjs/fibx-router receives a total of 0 weekly downloads. As such, @fibjs/fibx-router popularity was classified as not popular.
We found that @fibjs/fibx-router 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.