
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
- Auto Routes [simple & Advanced]
- Handle Request & Response Headers [Cookies - Query Strings]
- Auto Detect & Configer User Session
- Easy Creating Master Pages
- Compain Multi Files Contents in One Route
- Auto Caching Files in Memory
- Fast Read Files Content [Site Folder Structure]
- Custom Html Attributes [imports]
- MD5 Hash Function
npm install isite --save
var isite = require('isite')
var site = isite() // default port = 80 & dir = ./site_files
site.run()
Advanced Using
var isite = require('isite')
var site = isite({
port:8080 ,
dir:__dirname + '/site_files' //folder contains site files structure
})
site.run()
Easy and Auto Site Routing
site.addRoute({name: '/css/bootstrap.css',path: site.dir + '/css/bootstrap.min.css'});
site.addRoute({
name: '/js/script.js',
path: [site.dir + '/js/jquery.js' , site.dir + '/js/bootstrap.js']
});
site.addRoute({name: '/',path: site.dir + '/html/index.html'});
site.addRoute({name: '/api',path: site.dir + '/json/employees.json' , method:'POST'});
Advanced Site Routing
site.addRoute({
name: '/',
callback: function (req, res) {
res.setHeader('Content-type', 'text/html');
res.writeHead(200);
site.html('index', function (err, content) {
res.end(content);
});
}
});
site.addRoute({
name: '/api',
method: 'POST',
callback: function (req, res) {
res.setHeader('Content-type', 'application/json');
res.writeHead(200);
site.json('index', function (err, content) {
res.end(content);
});
}
});
site.get('/api/set' , function(req , res){
req.cookie.set('id' , 'userid')
res.end('cookie set ok !!')
})
site.get('/api/get' , function(req , res){
res.end(' id : ' + req.cookie.get('id'))
})
site.get('/login', function(req, res) {
req.session.set('username', 'amr barakat')
res.end('loged ok !! ')
})
site.get('/userInfo', function(req, res) {
var userName = req.session.get('username')
res.end(userName)
})
site.html('index', function (err, content) {
console.log(content);
});
site.css('bootstrap', function (err, content) {
console.log(content);
});
site.js('jquery', function (err, content) {
console.log(content);
});
site.json('items', function (err, content) {
console.log(content);
});
add Custom Master Page And Using it ..
site.addMasterPage({
name: 'masterPage1',
header: site.dir + '/html/header.html',
footer: site.dir + '/html/footer.html'
})
site.get({
name: '/ContactUs',
masterPage : 'masterPage1',
path: site.dir + '/html/contact.html',
parser: 'html'
});
Add Custom Html Content
<h2 x-import="welcome.html"></h2>
Page "welcome.html" Must Be In HTML Site Dir ['/site_files/html/welcome.html']
site.addVar('siteName', 'First Site With Isite Library ');
site.addVar('siteBrand', 'XSite');
<title>##var.siteName##</title>
<h2>##var.siteBrand##</h2>
FAQs
Create High Level Multi-Language Web Site [Fast and Easy]
The npm package isite receives a total of 129 weekly downloads. As such, isite popularity was classified as not popular.
We found that isite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.