
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@jasonsoft/express-controller
Advanced tools
Controller extension by express router middleware
Controller extension by express router middleware 🦀
npm i --save @jasonsoft/express-controller
/**
* Example: https://github.com/jasonsoft-net/jasonsoft-express-server
* FilePath: /jasonsoft-express-server/app.js
* Added by Jason.Song (成长的小猪) on 2021/09/28
* CSDN: https://blog.csdn.net/jasonsong2008
* GitHub: https://github.com/jasonsoft-net
* Organizations: https://github.com/jasonsoft
*/
import Express from 'express';
/**
* Import the ControllerProvider from @jasonsoft/express-controller
*/
import { ControllerProvider } from '@jasonsoft/express-controller';
const app = new Express();
/**
* Inject the controller directory
*/
ControllerProvider.initControllers({
router: app,
/** The default directory is './src/controllers' */
dir: './app/controllers',
});
/** Service port */
const port = Number(process.env.PORT || 3000);
/** Listening port */
app.listen(port, () => {
console.log(
`[\x1B[36mRunning\x1B[0m] Application is running on: http://localhost:${port}`,
);
});
/**
* Import Controller, Get, Post, Put, Delete, Patch, Options, Head, All, etc. decorators
*/
import {
Controller,
Get,
// Post,
// Put,
// Delete,
// Patch,
// Options,
// Head,
// All,
} from '@jasonsoft/express-controller';
/** Inject the controller decorator */
@Controller()
export default class AppController {
constructor() {
this.message = {
title: 'Welcome to use jasonsoft-express-server template',
author: 'Jason.Song',
github: 'https://github.com/jasonsoft-net',
organization: 'https://github.com/jasonsoft',
};
}
/**
* GET http://localhost:3000/
*/
@Get()
async index() {
return this.message;
}
}
/**
* Import Controller, Get, Post, Put, Delete, Patch, Options, Head, All, etc. decorators
*/
import {
Controller,
Get,
// Post,
// Put,
// Delete,
// Patch,
// Options,
// Head,
// All,
} from '@jasonsoft/express-controller';
@Controller('users')
export default class UsersController {
constructor() {
this.users = [
{
id: 1,
username: 'jason',
},
{
id: 2,
username: 'steve',
},
];
}
/**
* GET http://localhost:3000/users
*/
@Get()
async getUsers() {
return this.users;
}
/**
* GET http://localhost:3000/users/1
*/
@Get(':id')
async getUserById(req) {
const { id } = req.params;
return this.users.find((user) => user.id === +id);
}
}

FAQs
Controller extension by express router middleware
We found that @jasonsoft/express-controller 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.