KApp is a boilerplate to build a slim Node.js App server that serves a web App and responds to api requests from the web App.
You can easily get your first KApp Server running in a couple of minutes by just typing a few command lines. But first, you need to create an empty folder. It will contain your project.
Then, you just need to create a package.json file that contains:
{
"name": "NameOfYourProject",
"scripts": {
"create": "npm install @mobilabs/kapp && npm run populate",
"populate": "kapp populate --name $npm_package_name --author $npm_package_config_name --acronym $npm_package_config_acronym --email $npm_package_config_email --url $npm_package_config_url && npm install"
},
"config": {
"name": "John Doe",
"acronym": "jdo",
"email": "jdo@johndoe.com",
"url": "http://www.johndoe.com/"
}
}
Replace NameOfYourProject by your project name and fill config with your credentials.
And finally, type in the terminal:
npm run create.
Your project is almost ready. As, KApp relies on https, you have to add your certificates in the folder server/ssl or you can disable https (not recommended) in server/config.js.
Now you can starts your server by typing:
npm run app
Open your browser and connect to your server with the url http://localhost:1080 or https://localhost:1443.
Open a terminal and type:
node examples/node/test.js
Open a terminal and type:
sh examples/curl/curl.sh
or:
sh examples/curl/curl_cookie_login.sh
You can easily add new APIs to KApp by filling the _custom folder.
The _custom/api
folder contains your new APIs, the folder _custom/controllers contains the APIs implementation and the _custom/dbi folder contains the methods to fill/read the database.
That's all.
MIT.
-- oOo ---