node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป

boot-web

boot-web

A mini web server with nodejs.

example:



    const BootWeb = require('boot-web');
    
    const EjsTest = require('./EjsTest');
    const RegRouteTest = require('./RegRouteTest');
    
    let web = new BootWeb.Boot();
    
    // webServer.setTemplate('ejs');
    // webServer.setTemplateRoot(path.join(__dirname, 'view/tpls'));
    
    web.use(new BootWeb.BaseAuth());
    web.use(new BootWeb.QueryString());
    web.use(new BootWeb.Cookie());
    web.use(new BootWeb.Session());
    web.use(new BootWeb.Static());
    web.use(new BootWeb.BodyParser());
    
    //app.use('/users/:name', new RouteTest());
    web.use('/photo/:up', new RegRouteTest());
    web.get('/test/', new EjsTest());
    
    web.listen(3015);

visit http://localhost:3015 to see the static index page.

http://localhost:3015/photo/yzg to test the regular expression route match

http://localhost:3015/test/ to test the ejs template file rendering