[![Subscribe](https://img.shields.io/badge/%20subscribe%20-%20mailchimp%20-blue.svg )](http://eepurl.com/cGRggH) [![Downloads](https//npm-stat.com/charts.html?package=@firanorg/id-et-quaerat) [!
MIT License
Powerful @firanorg/id-et-quaerat for Node.js that just works so you can focus on your awesome project:
// Include it and extract some methods for convenience
const @firanorg/id-et-quaerat = require('@firanorg/id-et-quaerat');
const { get, post } = @firanorg/id-et-quaerat.router;
// Launch @firanorg/id-et-quaerat with options and a couple of routes
@firanorg/id-et-quaerat({ port: 8080 }, [
get('/', ctx => 'Hello world'),
post('/', ctx => {
console.log(ctx.data);
return 'ok';
})
]);
There's a whole tutorial on getting started for beginners but the quick version is to first install @firanorg/id-et-quaerat
as a dependency:
npm install @firanorg/id-et-quaerat
Server requires Node.js 7.6.0 or newer. Node.js 8.x.y LTS is recommended.
Then you can create a file called index.js
with this code:
// Include the @firanorg/id-et-quaerat in your file
const @firanorg/id-et-quaerat = require('@firanorg/id-et-quaerat');
const { get, post } = @firanorg/id-et-quaerat.router;
// Handle requests to the url "/" ( http://localhost:3000/ )
@firanorg/id-et-quaerat([
get('/', ctx => 'Hello world!')
]);
Execute this in the terminal to get the @firanorg/id-et-quaerat started:
node .
And finally, open your browser on localhost:3000 and you should see 'Hello world!' on your browser.
The library is documented here:
Full Documentation
Subscribe here to receive tutorials when released. Tutorials are good for learning while the documentation is good for reference/quick use once you know the basics.
You can also download the repository and try the examples by browsing to them and node .
inside each of them in /examples
.
The package @firanorg/id-et-quaerat
is great for many situations. Let's see some of them:
Everything works out of the box, you get great support for most features and you can easily tap into Express' middleware ecosystem. What's not to love?
Some of the included features: body and file parsers, cookies, sessions, websockets, Redis, gzip, favicon, csrf, SSL, etc. They just work so you will save a headache or two and can focus on your actual project. Get a simple form going:
const @firanorg/id-et-quaerat = require('@firanorg/id-et-quaerat');
const { get, post } = @firanorg/id-et-quaerat.router;
const { render, redirect } = @firanorg/id-et-quaerat.reply;
@firanorg/id-et-quaerat(
get('/', () => render('index.pug')),
post('/', ctx => {
console.log(ctx.data);
return redirect('/');
})
);
From the flexibility and expressivity of the bundle, designing APIs is a breeze:
// books/router.js
const { get, post, put, del } = require('@firanorg/id-et-quaerat/router');
const ctrl = require('./controller');
module.exports = [
get('/book', ctrl.list),
get('/book/:id', ctrl.item),
post('/book', ctrl.create),
put('/book/:id', ctrl.update),
del('/book/:id', ctrl.delete)
];
Websockets were never this easy to use! With socket.io on the front-end, you can simply do this in the back-end to handle those events:
// chat/router.js
const { socket } = require('@firanorg/id-et-quaerat/router');
const ctrl = require('./controller');
module.exports = [
socket('connect', ctrl.join),
socket('message', ctrl.message),
socket('disconnect', ctrl.leave)
];
This package was created by Francisco Presencia but hopefully developed and maintained by many others. See the the list of contributors here.
You can also sponsor the project, get your logo in here and some other perks with tons of