How to install fasteejs

1npm install fasteejs

Usage

import Fastee from fasteejs and pass port number or leave it blank to use default

1import {Fastee} from "fasteejs"
2
3   const app = new Fastee(); //uses defaults
4   const app1 = new Fastee({port:4000,delay:30000}) //pass port and shutdown delay
5   let server = http.createServer().listen(5000)
6   const app2 = new Fastee({server,delay:30000}) //passed listening server must be already running
7   app.get('/', function (req, res) {
8      res.text('Hello World')
9   })
10
11   app.static("static",{dotfiles:false}) //pass valid folder path and optional config
12
13  //shutdown listener
14 app.onShutdown((signal)=>{
15   //call service before shutdown
16   console.log("before",signal)
17 })
18
19   export {app,app1,app2}

router

create routes to separate functionality between modules

1//valid path is required /api/ not applicable
2  const api = app1.Router("/api") 
3
4  api.get("/",(req,res)=>{
5     console.log(req)
6  })

static folder

serve static folder

1//valid path to the folder is required 
2  const frontend = app1.static("public") //no config
3
4  //folder 2
5  const assets = app1.static("static",{etag:true}) //yes config

request methods

1req.validate //validates schema against req.body and returns validated req.body
2  req.getip
3
4  and others
5  console.log(req)

response methods

1res.validate //validates schema against passed data and returns validated res.validated
2  res.text
3  res.html
4  res.json
5  res.send  //wild function does alot
6  res.stream
7  res.redirect
8  and others
9
10  console.log(res)

made with love by and much love yei pouchlabs!