3.1.4 • Published 8 days ago

gnodejs v3.1.4

Weekly downloads
35
License
MIT
Repository
github
Last release
8 days ago

gnodejs

NodeJS Manager Library

How to install the library

npm i gnodejs --save

How to include the library

const APP = require('gnodejs')

How to use express

The express server can also be the SSL server (like a local web server), provide the location based on the domain name from let's encrypt

APP.xpr.load()
APP.xpr.load('mydomain.com')
APP.xpr.add(
  'get',
  '/user/:id',
  (res, ip, requestedDATA, cookieOrSession, filesPosted, hostname) => {
    //the res item is the same as always
    //ip is the Source IP of the request
    //requestedDATA is the paramaters, already formatted, in the request, in this example you can use requestedDATA.id the data is auto formatted to an object regardless or source
    //cookieOrSession is the object of the cookie or override session function
    //filesPosted is the object of the files posted from the request
    //hostname is the name of the host in the request. this is useful when using virtual hosts in the same node core
    if (parseInt(requestedDATA.id) > 0) {
      res.json({ user: 'valid' })
    } else {
      res.status(400).json({ user: 'invalid' })
    }
  },
)

The express server can also process user authentication

APP.xpr.load('mydomain.com')
APP.xpr.add(
  'get',
  '/user/:id',
  (res, ip, requestedDATA, cookieOrSession, filesPosted, hostname) => {
    //the res item is the same as always
    //ip is the Source IP of the request
    //requestedDATA is the paramaters, already formatted, in the request, in this example you can use requestedDATA.id the data is auto formatted to an object regardless or source
    //cookieOrSession is the object of the cookie or override session function
    //filesPosted is the object of the files posted from the request
    //hostname is the name of the host in the request. this is useful when using virtual hosts in the same node core
    if (parseInt(requestedDATA.id) > 0) {
      res.json({ user: 'valid' })
    } else {
      res.status(400).json({ user: 'invalid' })
    }
  },
  (headers) => headers.auth == 'isvalid',
)

Happy Coding!

3.1.4

8 days ago

3.1.3

2 months ago

3.1.2

2 months ago

3.1.1

2 months ago

3.1.0

2 months ago

3.0.4

6 months ago

3.0.3

6 months ago

3.0.2

6 months ago

3.0.1

6 months ago

2.1.2

2 years ago

2.0.7

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

2.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago