Sam.io
is a node.js
framework for http
and socket.io
server application. It's simple, lightweight and familiar!
Sam.io framework
supports both experienced programmers and newbies to develop node.js
application in a structured way and easy to maintain.
It's used to build real-time applications, user activity tracking systems, chat applications and it's good for any web application project.
To get started, let's create a Controller to handler requests by creating new home-controller.js
file in /controllers
directory
module.exports = HomeController;
function HomeController() {
this.helloworld = function (io) {
io.echo("hello world");
};
}
Routing requests to the above controller. Open /start/routes.js
file and add the following route:
route.get("/", "HomeController@helloworld");
or without a controller:
route.get("/", function(io) {
io.echo("hello world");
});
Start the app:
node app.js
and send a http request, then it should print out: "hello world"
curl http://localhost:2307/
sam.io
framework is easy to install:
-
Get the latest stable release of Sam.io :
$ npm install sam.io -g
-
Create a new application:
$ sam ini app-name
-
Change current directory to the app directory:
$ cd app-name
-
Finally, let's start:
$ node app.js
The directory contains resource files.
As the name imples, cantains all application configurations such as: application port, debug mode, session configuration, autoload class map, service providers, etc.
The default directory contains application controllers.
By default, all controllers in this directory will be loaded automatically at booting time that configured as autoload directory in config.app
file.
The directory contains core modules of the framework.
Exploring it and you can learn about the framework's activity mechanism.
Third-party libraries should be stored in this drectory.
An autoloaded directory that used as default directory for service classes.
The directory loaded automatically at booting time
You will want to set start parameters in this. Including routes, event listeners or anything that configured as autoloaded directory , etc.
The directory contains session files, logs, compiled files by the framework and by included libraries.
This directory may be used to store any files utilized by your application.
Unit test classes should be stored in this directory.
The Apify is open-sourced software licensed under the MIT license
Email: phult.contact@gmail.com
Skype: phult.bk