@becquerel/framework
Yet another web framework experiment.
Install
$ yarn add @becquerel/framework # Or alternately: `npm install @becquerel/framework`
Usage
'use strict';
const Bq = require('@becquerel/framework');
const app = new Bq();
app.route('/', {
get: (request, response) => {
response.json = {hello: 'world'};
}
});
app.route('/hello', {
get: (request, response) => {
response.html = '<p>...world</p>';
}
});
app.route('/hello/{var}', {
get: (request, response) => {
response.json = {valueOfVar: request.uriVariables.var};
}
});
app.run();
Environment Variables
BQ_DEFAULT_CHARSET
(default: utf-8
)
The default charset used for framework responses.
BQ_RUN_DEFAULT_PORT
(default: 8080
)
The port that the app will bind to if settings.port
is not passed to #run()
.
BQ_RUN_DISPLAY_MSG
(default: true
)
If true
the app will display the Now listening at <${uri}>.
message upon launch.
Testing
$ yarn test # Or alternatively: `npm test`
License
The MIT License (Expat). See the license file for details.