Http server for Qwebs Qwebs.
npm install $qwebs --save
npm install $qwebs-http --save
"use strict";
class Service {
constructor() {
};
index(request, response) {
let content = {
text: `hello ${request.params.name}`
};
return response.send({ request: request, content: content });
};
exports = module.exports = Service;
{
"services": [
{ "name": "$http", "location": "qwebs-http"},
{ "name": "$service", "location": "./service"}
],
"locators": [
{ "get": "/:name", "service": "$service", "method": "index" },
]
}
{
"routes": "./routes.json",
"http": {
"port": 3000
}
}
{
"routes": "./routes.json",
"https": {
"port": 3443
}
}
{
"routes": "./routes.json",
"http": {
"port": 3000,
redirect: true
}
"https": {
"port": 3443
"key": "./certificate.key",
"cert": "./certificate.crt",
"ca": [
"./certificate.interm.1.pem",
"./certificate.interm.2.pem"
]
}
}
Create a server.js
"use strict";
const Qwebs = require("qwebs");
new Qwebs().load();
Run server on http://localhost:3000
node server.js