
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
tiny-service
Advanced tools
a tiny service library for generate service functiions
const {Service} =require('tiny-Service');
// const model= ...;
const roleService=Service(model);
the shape of roleService is
{
/**
* return the model itself
* @return model
*/
getModel:function(){ },
/**
* create model
* @param record
* @return {Promise<model>}
*/
create:model.create,
/**
* remove model
* @return {Promise<model>}
*/
remove:function(id){ },
/**
* update model
* @param {Integer} id model id
* @return {Promise<model>} model 的JSON对象
*/
update:function(id,record){ },
/**
* 根据ID查找
* @param {Integer} id model id
* @return {Promise<model>} model 的JSON对象
*/
findById:function(id){ },
/**
* find and count all models by page ,size ,condition
* @param {Number} page current page
* @param {Number} size page size
* @param {*} condition
* @return {Promise<{count:Number,rows:[]}>}
*/
list:function(page=1,size=10,condition={}){ },
/**
* list all recent models by page ,size ,condition, order by createdAt desc .
* model must have a createAt field
* @param {Number} page current page
* @param {Number} size page size
* @param {*} condition
* @return {Promise<{count:Number,rows:[]}>}
*/
recent:function(page=1,size=10,condition={}){ },
}
to override the default method of service , just rewrite it:
roleService.list=function(page,size,condition){
// implement
};
const {Middleware}=require('tiny-service');
// ... const roleService= ...;
const middleware=Middleware(roleService);
const router=express.Router();
const middleware=Middleware(resourceService);
router.post('/create',bodyParser.json(),middleware.create);
router.post('/remove',bodyParser.json(),middleware.remove);
router.post('/update',bodyParser.json(),middleware.update);
router.post('/list',bodyParser.json(),middleware.list);
router.post('/recent',bodyParser.json(),middleware.recent);
module.exports=router;
FAQs
a tiny api library
The npm package tiny-service receives a total of 9 weekly downloads. As such, tiny-service popularity was classified as not popular.
We found that tiny-service 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.