ksp-express
Create a express web site with ksp framework
This package need ksp framework. You can find him by clicking here
Install
$ npm install ksp ksp-express
Usage
const ksp = const kspExpress = kspksp ksp ksp
More example can be found here (eg. router/middleware/404)
Ksp Methods
express init
(?callback: () => void)
Init the express app
ksp
express use
(fn: function)
Allow you to use middleware or 404 page
ksp
express set
(key: any, value: any)
Allow you to set your key to express
ksp
express core get
(): express.App
Get the express app
var app = ksp
express core set
(app: express.App)
Set the express app
var app = ...ksp
express route (get/post/put)
(url: string, run: function)
Create a get/post/put route
ksp
express router create
(url: string)
Create a router
ksp
express router (get/post/put)
(url: string, run: function, router: express.Router)
Create a get/post/put route to the router
ksp
express send
(response: any, res: express.Response)
Send a response to a route
ksp
express send with status
(response: any, status: number, res: express.Response)
Send a response with a status to a route
ksp
express render
(view: string, data: any, res: express.Response)
Render a view to a route
ksp
express redirect
(url: string, res: express.Response)
Redirect to an url
ksp
express listen
(port: number, ?callback: (?port: numbre) => void)
Listen the express app
ksp
Contribution
You can fork the repository, improve or fix it and then send the pull requests back if you want to see them here. I really appreciate that. ❤
License
MIT License
Copyright (c) 2019 dotjov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.