Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Ti is a MVC web application server framework for node.js. It provides the basic development framework and some related components, including libraries and tools.
npm install Ti
node ./sample/test.js
Application's document path
//------------------app path------------- |--app |----app.js // app input file |----controller //controller path |----site.js //site controller ------... |----view //template path |----inc |----header.tpl |----index.tpl |----... |----model //model path |----plugin |----...
//get application var App = require('ti').application; //definne product path; var productPath = process.cwd(); var app = new App({ //configure controller path controllerPath:productPath+"/controller", //configure default controller name defaultController:'site', //route config routes:{ 'p-':"product/detail",//'p-','controller/action' }, //port port:5927, //configure route start sep baseUriIndex:0, //configure template path viewPath:productPath+'/view', //configure template plugin path templatePluginPath:productPath+"/plugins/view" }); //app start app.start();
###Model
//path:model/product.js //demo for product module.exports = { getItem:function(id){ //code for getItem return { id:id, title:"Demo for product", content:"Demo for product content" } }, getList:function(){ //code for getList } }
###Controller
//demo for ProductController //path: controller/product.js var Controller = require('ti').Controller; //exports module.exports = new Controller({ detailAction:function(req,res){ var id = req.params.id, productModel = require('model/product'), item = productModel.getItem(id); this.display('test.tpl',item); } });
###View
<!DOCTYPE> <head> <title>Ti-Demo</title> </head> <html> <body> <h1><%=title%></h1> <p><%=content%></p> </body> </html>
####openTag is : <% ####closeTag is : %> You can modify it like this:
var template = require('ti').template; template.openTag = "<{" ; // You custom openTag put here. template.closeTag = "}>" ;// You custom closeTag put here.
####include a tpl
<%=include('a.tpl',data)%>
###template plugin:
var template = require('ti').template; //define a template plugin template.plugin('escape',function(str,type){ //code for plugin //need return what u want; return str; });
//use a plugin in xxx.tpl
<p><%=title|escape:"html"%></h1>
####some default plugin: escape: escape tpl var for html or url :
default: set a default value for tpl var;
truncate: truncate tpl var ;
#####then,open browse and view: http://127.0.0.1:5927 Enjoy.
FAQs
A simple MVC framework for node web server.
The npm package ti receives a total of 10 weekly downloads. As such, ti popularity was classified as not popular.
We found that ti 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.