# quark.io

> The minimalistic web framework for creating small and beautiful HTTP servers.

Latest version **0.0.4** (published 2015-01-11) · MIT license · 0 weekly downloads

## Install

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

## 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.0.4 |
| Published | 2015-01-11 |
| First published | 2014-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Alex Saskevich @asaskevich |
| Maintainers | asaskevich |
| Keywords | framework, web, rest, restful, router, app, api, simple, http |

## Links

- npm: https://www.npmjs.com/package/quark.io
- Repository: http://github.com/asaskevich/quark.io
- Issues: http://github.com/asaskevich/quark.io/issues
- npm.io page: https://npm.io/package/quark.io

## Dependencies (4)

- [jade](https://npm.io/package/jade.md) ~1.8.1
- [colors](https://npm.io/package/colors.md) ~1.0.3
- [url-pattern](https://npm.io/package/url-pattern.md) ~0.6.0
- [object-sizeof](https://npm.io/package/object-sizeof.md) ~0.1.2

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2015-01-11
- 0.0.3 — 2015-01-10
- 0.0.2 — 2014-12-30
- 0.0.1 — 2014-12-30

## README

quark.io - minimalistic web framework for Node.js
======
[![npm version](https://badge.fury.io/js/quark.io.svg)](http://badge.fury.io/js/quark.io)

**quark.io** is the minimalistic web framework for creating small and beautiful HTTP servers.

#### Main features
* Less dependencies from others packages
* Easy routing
* Jade support
* Static files
* Middleware

#### Installation
Just do `npm install quark.io`

#### Hello World Server

```js
var quark = require('./quark.io');

var app = new quark({
    port: 3002
});

app.get('/', function(req, res) {
    res.ok('Hello, World!')
});

app.start();
```

#### Another examples
Another examples look at the `examples` directory of the repository.

#### Creating new server

```js
var quark = require('./quark.io');

var app = new quark({
    port: 3002, // Listening port, by default 8888
    debug: true, // Debug mode, will produce more output to the logger
    statics: ['public/', 'uploads/'], // Static directories, this array by default empty.
    logger: < Any logger that has similar methods as console >, // By default output goes to the console
    renderTemplate: < Any callback function that acts as 'jade.render' >, // By default used 'jade.render'
    renderFile: < Any callback function that acts as 'jade.renderFile' >, // By default used 'jade.renderFile'
});
```

#### Routing

Simple routes:

```js
app.get('/', function(req, res) { ... });
app.post('/user/save', function(req, res) { ... });
app.put('/user/update', function(req, res) { ... });
app.delete('/user/remove', function(req, res) { ... });
```

Routes with arguments (argument names in route **should be** equals to the names of the arguments of function):

```js
app.get('/topics/:topicId/message/:message', function(req, res, topicId, message) { ... });
app.post('/user/:userId/send/:message', function(req, res, userId, message) { ... });
```

#### Middleware

```js
function middleware(req, res) {
    console.log('Middleware active!');
};

function anotherMiddleware(req, res) {
    console.log('Another middleware active!');
};

app.get('/', function(req, res) { ... }, middleware, anotherMiddleware);
```

#### Requests and responses
Requests and responses are fully compatible with native node.js implementation. But response has some new features:

```js
res.send(data, [code, [headers]]);
res.fail(data, [headers]);
res.ok(data, [headers]);
res.text(data, [headers]);
res.html(data, [headers]);
res.json(data, [headers]);
res.redirect(data, [redirectUrl, [headers]]);
res.render(template, options);
res.renderFile(fileName, options);
```

#### Performance
Framework's performance tested with Apache Benchmark (all scripts and results inside `benchmark/` directory).

![Results](benchmark/benchmark.png)

#### Support
If you do have a contribution for the package feel free to put up a Pull Request or open Issue.


[![NPM](https://nodei.co/npm/quark.io.png)](https://nodei.co/npm/quark.io/)

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