1.0.0 • Published 5 years ago
quicksimple v1.0.0
使用方法
import {getExpressApp,listen,GET, Control,withRouter,ConnectionConfig,getMysql,Request,Response} from '../../quick';
@withRouter
@Control('/user')
class A {
    @GET('/login')
    public func(req:Request,res:Response) {
        const mysql = getMysql();
        let options:ConnectionConfig = {
            host:'localhost',
            port:3306,
            user:'root',
            password:'root',
            database:'crm'
        }
        mysql.setConfig(options);
        // mysql.delete('delete from student',{}).then((result)=>{
        //     res.end(JSON.stringify(result));
        // });
        mysql.select<{id:number}>('select * from student',{}).then((result)=>{
            res.end(JSON.stringify(result));
        });
       
    }
}
listen(9000,()=>{
    console.log('9000-----oprn');
});1.0.0
5 years ago