Skip to content
/ kapp Public

A boilerplate for a slim Node.js App server

License

Notifications You must be signed in to change notification settings

jclo/kapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KApp

NPM version GitHub last commit Github workflow Test coverage License

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.

Quick Startup

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

Access through a browser

Open your browser and connect to your server with the url http://localhost:1080 or https://localhost:1443.

Through Node.js

Open a terminal and type:

node examples/node/test.js

Through Curl

Open a terminal and type:

sh examples/curl/curl.sh

or:

sh examples/curl/curl_cookie_login.sh

Extend KApp

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.

License

MIT.

-- oOo ---

About

A boilerplate for a slim Node.js App server

Resources

License

Stars

Watchers

Forks

Packages

No packages published