Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isite

Package Overview
Dependencies
Maintainers
1
Versions
359
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isite - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

lib/prototype.js

17

index.js

@@ -9,9 +9,10 @@ module.exports = function init(options) {

require(__dirname + '/lib/prototype.js')
let events = require('events');
let eventEmitter = new events.EventEmitter();
site.on = function (name, callback) {
site.on = function(name, callback) {
eventEmitter.on(name, callback)
};
site.call = function (name) {
site.call = function(name) {
eventEmitter.emit(name);

@@ -54,3 +55,3 @@ };

site.vars = []; // site variables[name , value]
site.addVar = function (key, value) {
site.addVar = function(key, value) {
site.vars.push({

@@ -65,3 +66,3 @@ key: key,

site.sessions = []; // all sessions info
site.trackSession = function (session) {
site.trackSession = function(session) {

@@ -86,3 +87,3 @@ for (var i = 0; i < site.sessions.length; i++) {

site.masterPages = [];
site.addMasterPage = function (page) {
site.addMasterPage = function(page) {
site.masterPages.push({

@@ -94,8 +95,8 @@ name: page.name,

}
site.reset = function () {
site.reset = function() {
}
site.test = function () {
site.test = function() {
console.log(' Isite Test OK !! ');

@@ -102,0 +103,0 @@ };

@@ -8,2 +8,3 @@ module.exports = function init(site) {

function endResponse(req, res) {

@@ -76,3 +77,3 @@

if (typeof route.path == 'string') {
site.readFile(route.path, function (err, data) {
site.readFile(route.path, function(err, data) {
if (!err) {

@@ -100,3 +101,3 @@ route.content = data.toString('utf8')

} else if (typeof route.path == 'object') {
site.readFiles(route.path, function (err, data) {
site.readFiles(route.path, function(err, data) {
if (!err) {

@@ -135,3 +136,3 @@ res.setHeader('x-content', 'Route Read Files')

parser: r.parser || 'static',
masterPage : r.masterPage || null,
masterPage: r.masterPage || null,
cache: typeof r.cache == 'undefined' ? true : r.cache,

@@ -146,3 +147,3 @@ callback: r.callback || defaultCallback

add: add,
get: function (r, callback) {
get: function(r, callback) {
let route = typeof r == 'string' ? {

@@ -156,3 +157,3 @@ name: r.toLowerCase(),

},
post: function (r, callback) {
post: function(r, callback) {
let route = typeof r == 'string' ? {

@@ -166,6 +167,6 @@ name: r.toLowerCase(),

},
sendGet: function () {
let req = http.get("http://www.google.co.za/", function (res) {
sendGet: function() {
let req = http.get("http://www.google.co.za/", function(res) {
res.setEncoding()
res.on('data', function (chunk) {
res.on('data', function(chunk) {
console.log(chunk.length)

@@ -176,4 +177,4 @@ res.destroy()

},
run: function () { //First Function Will Run With Every Request
let app = http.createServer(function (req, res) {
run: function() { //First Function Will Run With Every Request
let app = http.createServer(function(req, res) {

@@ -188,6 +189,7 @@ res.setHeader('CharSet', 'UTF-8')

let route = url.parse(req.url.toLowerCase(), true)
for (let index = 0; index < routeList.length; index++) {
let r = routeList[index]
if (r.method.toLowerCase() == req.method.toLowerCase() && r.name == route.pathname) {
let url_route = url.parse(req.url.toLowerCase(), true)
for (let i = 0; i < routeList.length; i++) {
let r = routeList[i]
if (r.method.toLowerCase() == req.method.toLowerCase() && url_route.pathname.like(r.name)) {
if (!r.count) {

@@ -198,2 +200,3 @@ r.count = 0

req.route = r
req.url = url_route
r.callback(req, res)

@@ -205,3 +208,3 @@ return

if (route.pathname == '/') {
if (url_route.pathname == '/') {
res.setHeader('x-message', 'unhandled route')

@@ -212,2 +215,4 @@ res.writeHeader(200)

}
res.setHeader('x-message', 'unhandled route')

@@ -219,3 +224,3 @@ res.writeHeader(404)

app.listen(site.port, function () {
app.listen(site.port, function() {
console.log('')

@@ -222,0 +227,0 @@ console.log('-----------------------------------------')

{
"name": "isite",
"version": "1.0.9",
"description": "Fast & Easy Full Web Site Management",
"version": "1.1.0",
"description": "Create Fast & Easy Web Site with Full Development Features",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

# Features
- Auto Routes [simple & Advanced]
- Handle Request & Response Headers [Cookies - Query Strings]
- Auto Routes [simple & Advanced & Custom]
- Handle Request & Response Headers [Cookies - Parmeters]
- Auto Detect & Configer User Session

@@ -80,2 +80,22 @@ - Easy Creating Master Pages

```
Custom Route - Using * [any letters]
```js
site.get('/facebook/post/*', function(req, res) {
res.end('Any Route like /facebook/post/11212154545 ')
})
site.get('*', function(req, res) {
res.end('Any Route Requested Not Handled Before This Code')
})
```
Request Parameters
```js
site.get('/employee', function(req, res) {
res.end('ID : ' + req.url.query.id + ' , Name : ' + req.url.query.name)
})
```
## Cookies

@@ -82,0 +102,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc