
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@capujs/framework
Advanced tools
A framework build declarative and beautifully organizated based in class controllers with decorators usage in Express.js
A framework build declarative and beautifully organizated based in class controllers with decorators usage in Express.js
Install with yarn
yarn add @capujs/framework
#install types
yarn -D add @types/express
yarn -D add @types/cors
Its important enable decorators in you project tsconfig.json
{
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
ExampleController.ts
import { Controller, Get } from "@capujs/framework";
@Controller("/example")
export class ExampleController {
@Get("/")
testMethod() {
return "Hello Word";
}
}
import { createServer} from '@capujs/framework';
import { ExampleController } from './ExampleController';
const app = createServer({
controllers [ExampleController ]
});
//Listen express
const PORT = 3000;
app.listen(PORT,()=> console.log(`Server ready on port ${PORT}`);
Decorator | Example | Description |
---|---|---|
@Controller(prefix?: string) | @Controller("/test") class TestController | Register class with this decorator a registred as controller and its anotated methods are registred. it using express `res.send() |
Decorator | Example | Description |
---|---|---|
@Get(path?:string) | @Get('/users') all() | Method marked with this decorator register a request with GET method |
@Post(path?:string) | @Post('/users') save() | Method marked with this decorator register a request with POST method |
@Put(path?:string) | @Put('/users/:id') update() | Method marked with this decorator register a request with PUT method |
@Patch(path?:string) | @Patch('/users/:id') update() | Method marked with this decorator register a request with PATCH method |
@Delete(path?:string) | @Delete('/users/:id') remove() | Method marked with this decorator register a request with DELETE method |
@Head(path?:string) | @Head('/users/:id') head() | Method marked with this decorator register a request with HEAD method |
@All(path?:string) | @All('/users/:id') all() | Method marked with this decorator register a request with ALL method |
@Options(path?:string) | @Options('/users/:id') all() | Method marked with this decorator register a request with OPTIONS method |
Decorator | Example | Description |
---|---|---|
@Body(options?:IParamOptions) | save(@Body() data: CustomDto) | Inject a body an parameters options can using bodyParser middleware. using req.body |
@BodyParam(name:string, options?:IParamOptions) | save(@BodyParam('name') name:string) | Inject a body an parameters options can using bodyParser middleware. using req.body.name |
@Params() | get(@Params() params: any) | Inject all parameters req.params |
@Param(name:string, options?:IParamOptions) | get(@Param('id') id: string) | Inject a query parameter req.params.id |
@HeaderParams() | get(@HeaderParams() params: any) | Inject all parameters req.headers |
@HeaderParam(name:string, options?:IParamOptions) | get(@HeaderParam("authorization") authorization: string) | Inject a header parameter req.headers.authorization |
@CookieParams() | get(@Cookies( cookies: any) | Inject all cookies parameter req.cookies |
@CookieParam(name:string, options?:IParamOptions) | get(@Cookie("token") token: string) | Inject a cookie parameter req.cookies.token |
@UploadFiles(name:string, options?:IUploadOptions) | post(@UploadFiles("photos") photos: any[]) | Inject multiple upload files from parameter req.files using middleware express-fileupload |
@UploadFile(name:string, options?:IUploadOptions) | post(@UploadFile("photo") photo: any) | Inject single upload file from parameter req.files using middleware express-fileupload |
Decorator | Example | Description |
---|---|---|
@Use(...middleware: RequestHandler[]) | @Use(isAuthenticated) class ProfileController | Register global middleware. |
| Decorator | Example | Description |
| :------------------------------------- | :------------------------------------------------ | :----------------------------------------------- | -------------------------------------------------- |
| @HttpCode(code: number)
| @HttpCode(201) signup()
| Set custom http code after executing successfuly |
| @OnNull(codeOrError: number | Error)
| @OnNull(200) get()
| Set a http code when controller return a null |
| @OnUndefined(codeOrError: number | Error)
| @OnNull(200) get()
| Set a http code when controller return a undefined |
| @Header(name: string, value: string)
| @Header('Authorization','some-token') profile()
| Set a http header after executing successfuly |
FAQs
A framework build declarative and beautifully organizated based in class controllers with decorators usage in Express.js
We found that @capujs/framework 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.