Web framework for HTTP and HTTPS, using ExpressJS, Session, Mongo, Socket IO, Redis
npm install ernestBy cevr. For my son
Just create a public folder inside your project directory, put your files inside and do this:
``js`
var Ernest = require('ernest');
new Ernest(null,__dirname + "/public").listen();
And your server is running on PORT:80 (http), loading your "public" folder.
If you are trying something bigger:
`js
new (require('ernest'))(db_name,iport,jsonlimt_mb,session_name,session_secret).
listen(otherorigins,key,cert,socketio_redis_port, isocketio_redis_server)
.LoadModules(function(app,dbc,messenger_io,ernest)
{
app.get("/hi",function(req,res,next) {res.send("Hi, Im Ernest"); });
}).Permission_Session(access_mongodb_collection).Static(ipublic).TextOnError('Access Denied').EnableCLI();
EXAMPLE with new Features:
new (require('ernest'))("ernest", 80,90,"str_key","str_secret")
.listen(true,null,null,6379,'localhost')
.Permission_Session("access")
.LoadModules(function(a,d,m,e)
{
a.get("/hi",function(req,res,next)
{
res.send(
);
});
})
.RewriteASRC("Find","search")
.EnableASR("/foxtrot")
.Static("./public")
.TextOnError(' Acceso Denegado
Acceso Denegado
')
.EnableCLI();
`
#### db_name
Your mongo DB name(using mongojs name sintax).
By default no database.
#### ipublic
Your public folder.
By default the public folder inside ernest node_module.
On null set the public folder inside ernest node_module.
On "/" request = index.html
#### iport
The TCP Port you want the server to run(HTTP)
By default 80.
#### jsonlimt_mb
The max size of json body-parser urlencode
By default 90Mb
#### session_name
This is the name parameter for session (string)
By default the current date (string)
#### session_secret
this is the secret parameter for session (string)
By default the current date (string)
#### allowothersite
If is set(as true) will allow cross site request
by default disabled
#### key
The path to the file ".pem" (key.pem) of ssl certificate. If is set, enables https.
By default is undefined and disable https.
#### cert
The path to the file ".crt" (server.crt) of ssl certificate. If kep aparameter is set, ermest looks for it and enables https.
By default is undefined and disable https.
#### socketio_redis_port
If is set, enables socket_io with redis for asincronic real time communication.
this parameter is the port where redis server is running.
Dont forget, for using this option you have to start your Redis Server and put these scripts on your header html files:
`js