# sam.io

> A lightweight and powerful node.js framework to build http and socket.io server application.

Latest version **1.0.0** (published 2022-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install sam.io
pnpm add sam.io
yarn add sam.io
bun add sam.io
```

Provides the command `sam`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-09-20 |
| First published | 2018-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 487.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | PhuLuong |
| Maintainers | phult |
| Keywords | framework, http, socket.io, mvc, lightweight, server, engine, real time, notification, chat, rest |

## Links

- npm: https://www.npmjs.com/package/sam.io
- Repository: https://github.com/phult/sam.io
- Issues: https://github.com/phult/sam.io/issues
- npm.io page: https://npm.io/package/sam.io

## Dependencies (3)

- [copy-dir](https://npm.io/package/copy-dir.md) ^0.4.0
- [jsonfile](https://npm.io/package/jsonfile.md) ^4.0.0
- [commander](https://npm.io/package/commander.md) ^2.16.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-09-20
- 0.9.2 — 2020-09-25
- 0.9.1 — 2018-08-08

## README

# Introduction
`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.


# Hello world example

## 1. Creating a Controller
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");
        };
    }

## 2. Routing
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");
    });

## 3. Launching it
Start the app:

    node app.js 

and send a http request, then it should print out: "hello world"

    curl http://localhost:2307/

# Installation
`sam.io` framework is easy to install:

1. Get the latest stable release of Sam.io : `$ npm install sam.io -g`

2. Create a new application: `$ sam ini app-name`
   
3. Change current directory to the app directory: `$ cd app-name`

4. Finally, let's start: `$ node app.js`

# Directory structure

## `/assets`

The directory contains resource files.

## `/config`

As the name imples, cantains all application configurations such as: application port, debug mode, session configuration, autoload class map, service providers, etc.

## `/controllers`

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.

## `/core`

The directory contains core modules of the framework. 

Exploring it and you can learn about the framework's activity mechanism.

## `/libs`

Third-party libraries should be stored in this drectory.

## `/services`

An autoloaded directory that used  as default directory for service classes.

## `/start`

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.

## `/storage`

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.

## `/tests`

Unit test classes should be stored in this directory.

# Configuration
# Autoload class map
# Routing
# Filters
# Controllers
# Inputs and Responses
# Session
# IoC
# Services
# Events
# Logger

# License

The Apify is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
# Contact us/ Instant feedback

Email: phult.contact@gmail.com

Skype: [phult.bk](skype:phult.bk?chat)

---
_Source: https://npm.io/package/sam.io · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
