
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@appolo/agent
Advanced tools
Fast and simple http server build with typescript and appolo-route
npm install @appolo/agent --save
import {Agent} from '@appolo/agent'
await new Agent()
.get("/test/:id/", (req: IRequest, res: IResponse) => {
res.json({query: req.query, params: req.params})
}).listen(3000);
Options
port - port number to agent will listen default 8080errorStack - boolean print error stack on error default falseerrorMessage - boolean print error message default truemaxRouteCache - max number of cached routes paths with lru cache default 1000,useRouteCache - boolean use route path cache default truedecodeUrlParams - boolean use decodeURIComponent on path params default falseqsParser - module to use to parse querystring values qs | querystring default qs`viewEngine - like express view wngineviewFolder - view folder to search view paths default ``viewCache - boolean cache viewviewExt - views file ext default htmlawait new Agent({port:3000})
.get("/test/:id/", (req: IRequest, res: IResponse) => {
res.json({query: req.query, params: req.params})
}).listen();
get server(): http.Server | https.Serverget node http server
get router(): Routerget router instance
listen(port: number, cb?: Function): Promise<Agent>bind the agent to port call callback if provided return the agent instance
close(): Promise<void>close the agent connection to http server and clean everything
let app = new Agent()
.get("/test/test2", (req,res)=>res.send("working"));
.post("/test/test2", (req,res)=>res.send("working post"));
let router = new Agent()
.get("/test/:userId/:userName", (req,res)=>res.send("working"));
let router = new Agent()
.get("/*", (req,res)=>res.send("working"));
same syntax as path-to-regexp
let app = new Agent()
.get("/test/:file(^\\d+).png", (req,res)=>res.send("working"));
register new Route handler using Http.Get Method
register new Route handler using Http.Post Method
register new Route handler using Http.Put Method
register new Route handler using Http.Put Method
register new Route handler using Http.Patch Method
register new Route handler using Http.Delete Method
register new Route handler using Http.Delete Method
register new Route handler. multi methods supported
let agent = new Agent()
.add("POST","/test/:param", someMiddleware(),(req,res)=>res.send("working"));
the agent supports any express middleware or cusotom middalwares
import favicon = require('static-favicon');
import bodyParser = require("body-parser");
import {IRequest,IResponse,NextFn} from 'appolo-agent';
let agent = new Agent()
.use(bodyParser.json());
.use(function (req:IRequest, res: IResponse, next: NextFn) {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
})
.use(favicon());}
.get("/test/:param", someMiddleware(),(req,res)=>res.send("working"));
the request object inherits from http.incomingmessage
req.queryquery params object
req.bodybody parser params object
req.paramsroute params object
req.hostnamehost name of the request
req.pathpath name of the request
req.secureboolean true is the request is https
req.protocolprotocol of the request http or https
req.appinstance of the agent
req.get(name:string)req.header(name:string)Returns the specified HTTP request header
req.get('content-type'); // => "text/plain"
req.is(type:string)Returns the matching content type if the incoming request’s “Content-Type” HTTP header field matches the MIME type specified by the type parameter. If the request has no body, returns null. Returns false otherwise.
req.is('html'); // => 'html'
req.is('text/html'); // => 'text/html'
the response object inherits from http.ServerResponse
res.status(code: number): IResponseset response status code
res.status(200).json({name:"value"});
res.contentType(type: string): IResponseset response content type
res.header(key: string, value: string): IResponseres.set(key: string, value: string): IResponseset response header
set Cache-Control header in seconds
res.gzip(): IResponsecompress the response with gzip and set Content-Encoding header to gzip
res.redirect(path: string): voidredirect the request to new path
res.cookie(key: string, value: any, options?: cookie.CookieSerializeOptions): IResponsesets cookie name to value. The value parameter may be a string or object converted to JSON.
res.cookie('name', 'test', { domain: '.example.com', path: '/admin', secure: true });
res.cookie('someName', '{someVal:1}', { expires: new Date(Date.now() + 900000), httpOnly: true });
res.clearCookie(key: string, options?: cookie.CookieSerializeOptions): IResponseclears the cookie specified by name.
res.cookie('name', 'tobi', { path: '/admin' });
res.clearCookie('name', { path: '/admin' });
json(obj: object)sends a JSON response.
res.json({name:"value"});
jsonp(obj: object)Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support
res.jsonp({name:"value"});
render(params?: any): Promise<void>render view html by path and params
res.render('index');
res.render('/path/to/view');
res.render('index',{some:"data"});
send(data?: string | Buffer| object)res.send(new Buffer('some buffer'));
res.send({ some: 'data' });
res.send('<p>some html</p>');
res.status(404).send('not found');
res.status(500).send({ error: 'some error' });
MIT
FAQs
Fast and simple http server framework
The npm package @appolo/agent receives a total of 54 weekly downloads. As such, @appolo/agent popularity was classified as not popular.
We found that @appolo/agent 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
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.