npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

thinkr-mook

v1.0.5

Published

this is a easy use framework of node.js dependence express

Readme

Thinkr-Mook

声明 1.0.4版本漏掉了update方法的源码,以及create方法路由指定错误.现已修正。。。。

此模块是在Express.JS的基础上进行了再次的封装。目的是为通过简单的代码对与mongodb数据库数据实现RESTFUL形式的数据提供服务。

整体项目是需要提前安装 Express,mongoose,body-parser 模块的。

npm install express --save
npm install mongoose --save
npm install body-parser --save

使用说明

  • 安装此模块

    npm install thinkr-mook --save
  • 在你项目中添加实体类

    User.ts
  • 添加对于模块的引用,并添加实体类代码

    import {Entity,Property} from 'thinkr-mook'
    
    @Entity
    export class User{
        @Property
        name:string;
        @Property
        password:string;
    }
  • 在项目中添加数据服务类

    UserService.ts
  • 添加对于模块的引用,并通过装饰器注入实体类完成代码

    import {ServiceProvider} from 'thinkr-mook'
    
    @ServiceProvider({
        model:User
    })
    class UserService {}
  • 在根目录添加app.ts文件作为项目启动文件, 并在此文件中添加对于expressmongoose 模块的引用

    import * as express from 'express';

import * as mongoose from 'mongoose'; ```

  • 导入模块的引用

        import {Routing} from 'thinkr-mook'
  • 导入所声明UserService.ts

    import {UserService} from './UserService'
  • 完整的app.ts代码

    import * as express from 'express';
    import * as mongoose from 'mongoose';
    import {Routing} from 'thinkr-mook'
    import {UserService} from './UserService'
    
    var app = express();
    app.listen(3000);
    mongoose.connect('mongodb://127.0.0.1/数据库');
    /**注册数据服务
    *
    *  可在项目中添加多个服务类,最终注册时,以数组形式传入到路由中
    */
    Routing(app,[Service]);
  • 完成后即可启动服务器,所需要的CRUD方法都通过模块注入而生成。

访问说明

  • 访问地址在http://地址:端口/实体类名基础上

    • /list GET 获取数据
    • /create POST 添加数据
    • /update POST 修改数据
    • /delete POST 删除数据

    如实例代码中的User类,接口为:

    http://127.0.0.1:3000/user/list
    http://127.0.0.1:3000/user/create
    http://127.0.0.1:3000/user/update
    http://127.0.0.1:3000/user/delete
  • 发送POST请求时 所有参数均以

    'content-type': 'application/x-www-form-urlencoded'

    形式提交。

  • 参数列表:

    • /list -->无。
    • /craete -->实体类对象。
    • /update -->包含_id的实体类对象。
    • /delete -->_id:实体类对象_id属性。

    结果以JSON形式返回。