# xvi-express

> ExpressServer

Latest version **0.0.4** (published 2017-09-18) · Apache v2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install xvi-express
pnpm add xvi-express
yarn add xvi-express
bun add xvi-express
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2017-09-18 |
| First published | 2017-09-18 |
| Weekly downloads | 0 |
| License | Apache v2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8.4.0 |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Benoit Lavorata |
| Maintainers | blavorata |

## Links

- npm: https://www.npmjs.com/package/xvi-express
- Repository: https://github.com/sbglive/npm-xvi-express
- Homepage: https://github.com/sbglive/npm-xvi-express#readme
- Issues: https://github.com/sbglive/npm-xvi-express/issues
- npm.io page: https://npm.io/package/xvi-express

## Dependencies (7)

- [ip](https://npm.io/package/ip.md) ^1.1.5
- [express](https://npm.io/package/express.md) ^4.15.4
- [socket.io](https://npm.io/package/socket.io.md) ^2.0.3
- [multiparty](https://npm.io/package/multiparty.md) latest
- [xvi-helper](https://npm.io/package/xvi-helper.md) latest
- [xvi-logger](https://npm.io/package/xvi-logger.md) latest
- [cron-file-cleaner](https://npm.io/package/cron-file-cleaner.md) latest

## Recent versions

- 0.0.4 (latest) — 2017-09-18
- 0.0.3 — 2017-09-18
- 0.0.2 — 2017-09-18
- 0.0.1 — 2017-09-18

## README

# npm-xvi-express
Express Server

```javascript
//Add package
const Server = require('xvi-express');

//Create instance of the server
var instance = new Server({
    "protocol": "http",
    "port": 3000,
    "socketIO": true,
    "publicFolderPath": 'public/',
    "uploadFolder": 'uploads/'
});

//test function
async function test() {
    try {
        await instance.start();

        //Add route on server
        instance.addRoute({
            name: 'mainRoute', //name
            path: '/main-route', //path of the route
            prefix: 'main', //for log purpose
            type: 'get', //or post
            handler: async function (req, res) { // handler
                //res.send(true);
                return true;
            }
        });

        //Add IO event on server
        instance.addIOEvent({
            name: 'testHandler',
            handler: async function (args) {
                console.log(args);
                //this is a IO event
            }
        });
    } catch (err) {
        console.log(err);
    }
}
test();
```

Will output:
```
170918-213053 |   debug.ExpressServer | canStart = true
170918-213053 |   debug.ExpressServer | start
170918-213053 |   debug.ExpressServer | setServer
170918-213053 |   debug.ExpressServer | Started Server on port 3000
170918-213053 |   debug.ExpressServer | Set Route main, mainRoute on /main-route, type get
170918-213108 |   debug.ExpressServer | GET on: main.mainRoute
```

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