1.0.1 • Published 3 years ago

@imagineee/wing-js v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

wings-js

Fast web framework for Node js

npm.io npm.io npm.io npm.io npm.io npm.io npm.io npm.io npm.io npm.io npm.io

const wings = require("@imagineee/wing-js")
var app = new wings.server()

app.listen(3000, () => console.log("running on port 3000"))

app.use('files', '/public')

app.onGet("/", (ctx) => {
    ctx.res.send("hi")
})
app.onGet("/html", (ctx) => {
    ctx.res.sendFile('./public/index.html')
})

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm i @imagineee/wing-js

Features

  • Small: npm.io
  • Easy syntax
  • Fast to setup
  • More coming soon!

Philosophy

Wings is meant to be small, easy and fast out of the box with every thing provided.

Docs

To get started, import the module in your app after installation

const wings = require("@imagineee/wing-js")

API

  • new server() to make a new server add:
var app = new wings.server()
  • listen(port, callback) to start a server or listen on a port
    • port integer: the port to listen on
    • callback function: what to do when succeeded

example

app.listen(3000, () => console.log("running on port 3000"))
  • onGet('path', callback) to respond on a reqest on a path
    • path string: the path
    • callback function: what to do affter reciving a request

example

app.onGet("/", (ctx) => {
    ctx.res.send("hi")
})