# bianca-server

> Bianca server architecture for quick and safe nodejs applications

Latest version **0.1.6** (published 2016-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install bianca-server
pnpm add bianca-server
yarn add bianca-server
bun add bianca-server
```

## 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.6 |
| Published | 2016-08-05 |
| First published | 2016-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Quentin BERNET |
| Maintainers | quentink |
| Keywords | nodejs, server, quick, safe, bianca, restfull, api, static, dynamic, webservice |

## Links

- npm: https://www.npmjs.com/package/bianca-server
- Repository: https://quentink@bitbucket.org/quentink/bianca-server
- Homepage: https://bitbucket.org/quentink/bianca-server#readme
- npm.io page: https://npm.io/package/bianca-server

## Dependencies (3)

- [http](https://npm.io/package/http.md) 0.0.0
- [mysql](https://npm.io/package/mysql.md) ^2.5.4
- [colors](https://npm.io/package/colors.md) ^1.1.2

## Recent versions

- 0.1.6 (latest) — 2016-08-05
- 0.1.5 — 2016-08-03
- 0.1.4 — 2016-08-02
- 0.1.3 — 2016-08-02
- 0.1.2 — 2016-08-01
- 0.1.1 — 2016-07-29
- 0.1.0 — 2016-07-29
- 0.0.3 — 2016-07-29
- 0.0.2 — 2016-07-29
- 0.0.1 — 2016-07-29

## README

# BiancaJS, your new partner for your REST web server
Provide a safe and easy to use architecture for building RESTful nodejs applications.

It also allows to create full website backends:

* static pages
* dynamic pages, as well 

![logo bianca](http://img4.hostingpics.net/pics/648588resized.png)

# What's this?

## RESTful API

* URI (Uniform resource identifier) as resources identifiers 
* HTTP verbs as operations identifiers
    * classical ones: GET,POST,PUT,DELETE
    * extra cool features: OPTION,HEAD
* HTTP response codes as resources representations 
* link as relationship between resources (not fully implemented yet)
* authentification token (not fully implemented yet) 

## Static pages
It simply forward a staic file from the file system to the user without any transformation.

## Dynamic pages
According to some patterns you defined, it transforms a static file from the file system.

Then it sends the transformed stream to the user.

## Router
We handle your requests and will route them for you to the right service. See schema below :
![Route](http://img4.hostingpics.net/pics/138941servernodejs.png)

## Features

* easily editable and scalable
* includes a ready-to-use mysql connector
* configuration file for databases settings
* configuration file for BiancaJS
* logs file to maintain your application 

## Team 
* Cyril **CLEAUD** - Project Architect <cyril.cleaud@gmail.com>
* Quentin **BERNET** - Project Developer <q.bernet@gmail.com>


# Under the hood 
![Schema bianca](http://img4.hostingpics.net/pics/688557bianca.png)

## Static pages
Store your local resources such as HTML web pages or files that are free to be accessed by users

## Dynamic pages
Store your templates which can be dynamicaly edited by your server to render any pages you need. 

## Web service 
Handle different kinds of HTTP requests to access databases or file server management.
```js
this.doHead = function(p_httpUrl, p_body, p_responseWriterCallback) {
  p_responseWriterCallback(201, "No content", "text/html", "");
  // p_responseWriterCallback(404, "Not found", "text/html", "I'm sorry, I can't find anything for you.");
}
```
Will return a 201 HTTP code if you ask for a head request: ```HEAD http://localhost:8080/ws/v1/user```


# Technologies
* NodeJS


# Installing
```bash
npm init
npm install --save bianca-server
```

# How to...
## Include the bianca kernel into your project  
```js
var BiancaModule = require('bianca-server') 
var Bianca = new BiancaModule(); 
```

## Start your server with the init function    
```js
Bianca.init(); 
```

## Include new services  
Write your own services into business/version folder and simply add it into the conf/services.json file.  
You'll find an example of a service into business/v1/user.js file 
```json
{
  "name" :"sample user service",
  "description":"Example service for good usage",
  "author":"Bernard",
  "version":"v1",
  "service":"../business/v1/user.js"
}
```

## Implement new services
```js
this.doHead = function(p_response,p_httpUrl,p_body,callback)
this.doPost = function(p_response,p_httpUrl,p_body,callback)
this.doGet = function(p_response,p_httpUrl,p_body,callback)
this.doDelete = function(p_response,p_httpUrl,p_body,callback)
this.doPut = function(p_response,p_httpUrl,p_body,callback)
this.doOptions = function(p_response,p_httpUrl,p_body,callback)
```

# Dependencies
* http
* colors
* mysql

# What's next?
## Upcoming features
* include a mongoDB connector to easily manage your NoSQL databases into your backend project 
* authentification token
* service creation automation
* http headers extraction from queries

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