# ya-framework

> Yet another framework

Latest version **0.1.1** (published 2016-04-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install ya-framework
pnpm add ya-framework
yarn add ya-framework
bun add ya-framework
```

Provides the command `yat`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-04-21 |
| First published | 2016-04-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Karlito40 |
| Maintainers | karlito40 |

## Links

- npm: https://www.npmjs.com/package/ya-framework
- Repository: https://github.com/karlito40/yat
- Homepage: https://github.com/karlito40/yat#readme
- Issues: https://github.com/karlito40/yat/issues
- npm.io page: https://npm.io/package/ya-framework

## Dependencies (14)

- [chai](https://npm.io/package/chai.md) ^3.3.0
- [glob](https://npm.io/package/glob.md) ^5.0.15
- [jade](https://npm.io/package/jade.md) ^1.11.0
- [mime](https://npm.io/package/mime.md) ^1.3.4
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [react](https://npm.io/package/react.md) ^0.14.0
- [graphql](https://npm.io/package/graphql.md) ^0.4.7
- [promise](https://npm.io/package/promise.md) ^7.0.4
- [node-jsx](https://npm.io/package/node-jsx.md) ^0.13.3
- [react-dom](https://npm.io/package/react-dom.md) ^0.14.0
- [browserify](https://npm.io/package/browserify.md) ^11.2.0
- [jsx-loader](https://npm.io/package/jsx-loader.md) ^0.13.2
- [forge-struct](https://npm.io/package/forge-struct.md) 0.0.3
- [constant-list](https://npm.io/package/constant-list.md) 0.0.6

## Recent versions

- 0.1.1 (latest) — 2016-04-21
- 0.0.6 — 2016-04-21
- 0.0.4 — 2016-04-21
- 0.0.3 — 2016-04-16
- 0.0.1 — 2016-04-03

## README

Work in progress

## Why
Modularity is geat but sometime you just need something that works out of the box.

## Goal

+ Removing require functions (so you don't have to memorize things)
+ Forcing a structuration
+ Isomorphic javascript (only for the react components)
+ Monitoring (user, current log, errors, db call ...)
+ Cache
+ Static server (cdn + dev)
+ Hook code integration (event base)
+ Code deploy test (vm.. meteor)
+ jslint
```
npm install yat
```

### Command line

Create a new project

```
node node_modules/.bin/yat ```

Launch a project

```
node node_modules/ya-framework/index.js

```

+ bootstrap.js  (everything can be set here: route, app, module, model, ...)
+ routes        (group by filename)
+ modules       
+ node_modules/yat
+ models        
+ database      (queries)
+ public        (assets folder)
+ views         (jade only)
+ linter

### [WORKING] Bootstrap example
```
// DOES NOT NEED ANY REQUIRE

// Optional
App.set({
  DEBUG: true,              // :optional
  port: 9999,               // :optional
  publicFolder: './public'  // :optional
  ssl: {                    // active the https server :optional
     key: './key',  
     cert: './cert'  
  }
});

// Optional
Module.add([
  require('yat-varnish'),   // TODO
  require('yat-auth'),      // TODO
  require('yat-rabbitmq'),  // TODO
  require('yat-socketio'),  // TODO
])

// Optional
Router.get('/', function() {
  this.render('view_name');
})

// ...

```

### Router example

```
// bootstrap.js
// no require need

// Use a react component in a view (seo)
var reactComponent = require("../../public/js/components/app");
Router.get('/react', function() {

  this.render('test', {
    hello: 'world',
    partial: this.react(reactComponent)
  });

});

// Use a partial in a view
Router.get('/partial', function() {

  this.render('test', {
    hello: 'world',
    partial: this.partial('another_view', {
      foo: 'wooow'
    })
  });

});

// Json response
Router.get('/json', function() {
  this.json({
    foo: 'bar'
  });
});

// Of course async stuff are working
Router.get('/async', function() {
  setTimeout(() => {
    this.json({
      message: 'async works'
    })
  }, 100);
});

// If you do want something special
// There is still a possibility to use
// the request and the response object
// sent by node
Router.post('/simple/:uid', function(uid) {
  // console.log('this.req', this.req);
  this.res.end('uid:\n' + uid);
})



// Magical route
// There is no limit to the number of parameter
// http://localhost:9999/foo/2/toto
Router.get('/foo/:uid/:name', function(uid, name) {
  this.json({
    uid: uid,
    name: name
  });
});

// Delete
Router.del('/things/:fooId', function(fooId){
  this.json({
    message: `thing ${fooId} has been deleted`
  });
})

// Post method
// Body will alway be the last parameter
Router.post('/partial', function(body) {
  this.json(body);
});

Router.post('/example/:number/:uid/:foo', function(number, uid, foo, body) {
  this.json(body);
});

```

### View


## Internationalization

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