1.0.2 • Published 7 years ago

sarina.web v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Sarina.Web

Sarina Web is plugin to create web application based on sarina.
Sarina.Web created by JavadParvaresh.

Sarina.Web has build on top of Express and Vash.

Table of contents

Quick start

Several quick start options are available:

  • Clone the repo: git clone https://github.com/javadparvaresh/Sarina-Web.git
  • Install with npm: npm install sarina.web

Bugs and feature requests

Have a bug or a feature request? please open a new issue.

The Basics

var sarina=require("sarina");
var sarinaweb=require("sarina.web");

// create a sarina app by passing configuration
var app=sarina.create({
    web:{
        port:3000,
        webroot:"./webroot"Ï
    }
});
app.module(sarinaweb);

// start server easily by using server service
app.config("config",["sarina.web.config"],function(web){

    web.get("/",function(req,res){
        res.send("hello world");
    })
    web.get("/index",function(req,res){
        res.render("index",{title:"sample"});
    })
}); 

app.exec("run",["sarina.web.server"],function(webserver){
    return {
        run:function(resolve,reject){
            webserver.start().then(resolve).catch(reject);
        }
    } 
});

// finally we need to start app
app.start();
1.0.2

7 years ago