$ g++ -version
$ sudo apt-get install gcc-7.5.0 // For Installation
$ sudo apt-get install gcc-7.5.0 // For upgrade
$ sudo apt-get install espresso
To know which version installed:$ espresso+ --version // installed version: Espresso_1.0.0-v
For testing whether Espresso is properly working or not, just copy the following code in test.es
auto espresso = import("espresso").("http");
auto app = espresso();
app.get("/", function(request, response, err){
if(err == ERROR){
console.err("error: ", err );
}else{
response.send("hello world");
}
});
app.run("8080", function(err){
console.log("Server started at ", 8080 );
});
$ espresso+ test.es
$ ./espresso
Server started at 8080
localhost:8080
auto espresso = import("espresso");
// Standard
// User-defined
auto user-defined_lib = import("your-filename.es");
operator ()
is called that returns the main espresso application object which is again one-time created.
auto app = espresso();
GET, POST, DELETE and
PUT
Method that takes two arguments: a delimeter and a anonymous callback function. The anonymous callback function takes objects: request, response
and error as parameters. The third argument is flag: error which is optional.
app.get("/", function(request, response, err){
if(err == ERROR){
console.err("error: ", err );
}else{
response.send("hello world");
}
});
app.run("8080", function(err){
console.log("Server started at ", 8080 );
});