koorie
TypeScript icon, indicating that this package has built-in type declarations

2.4.58 • Public • Published

Koorie


Node.js server. ESModule asynchronous from the beginning of the Dreamtime.

⚠ Koorie shall be considered NOT ready for PRODUCTION.

⚠ This software won't run on Windows.


Description


The name Koorie.

Koorie borrows, with respect and admirance, its name from one of the Indigenous Australian clans so named Koorie.
Their beliefs about the creation of the whole reside in the "Dreamtime" stories. Many of these stories are expressed by artists of this clan and many others.
I intend to support the freedom and equality of tribes and indigenous humans all over the planet.
This name is a tribute to all the highest thoughts of equality.


Yet another Node.js server.

Nope, I wanted to understand the dynamics behind the more popular NodeJS servers around, like Fastify or Express just to cite some of them, and so I took a chance to develop one from scratch.
How is it going so far?
One commit is alright, the other one completely rewrites the app.
Fun, a lot of fun.


Design.

When installed, koorie comes with one executable to spin-up a server,
monitoring, making changes and other cool stuff ⎔,
Socket interface ⌖,
Change, add and remove routes without restarting the server ♨,

Cluster the server into many processes as many CPUs available ⑂
(--ease-fork will remove the restriction to fork for the available CPUs,
and cluster as many instances of Koorie you wish),

routes (middleware) ↬,
and last but not least, executable ejected koorie module ⏏.


Index of Contents


Installation & basic server launched

mkdir my-special-server &&
cd my-special-server &&
npm install koorie &&
npx koorie spin-up

the command above will spin-up a server with a similar output showed below.

----------------------------------------------------
koorie @ pid->23457 up and rocking
Koorie ♠ single instance
----------------------------------------------------
koorie your browser here ⬇ ︎
http://localhost:3001
----------------------------------------------------

Commands


spin-up

the main command to start a koorie server.

# this simple command will start up a server listening at localhost on port 3001
koorie spin-up

spin-up flags

--activate-socket(-as)

It instructs koorie to activate socket for interactive management.


--activate-socket-name(-asn)=['string']

It instructs koorie to activate socket for interactive management with the given name. Process PID will be appended to it for a unique filename generation.


--at-address(-a)=['string']

Server listening address.


--ease(-e)

It instructs koorie to ease application restriction for ports below 1024 [NOT Operating System restrictions].


--ease-fork(-ef)

It instructs koorie to ease application restriction for the number of forked processes related to nCPUS available.


--fork(-f)=['number']

fork n servers by the given cpus number. restricted on the available system cpus. set to 0, it forks n server as many available cpus. use the --ease-fork flag to ease the application restriction.


--http2(-h2)

spin up an http2 server.


--https(-hs)

spin up an https server.


--log-everything(-le)

Defaults Koorie will not log assets files like 'image, css, js etc etc'. It logs only 'routes, html files, 500 response code and 404 response code for all the files.

using this flag will instruct Koorie to log everything.


--no-log(-nl)

no log will be printed to stdout.


--no-log-file(-nlf)

no log will be saved to file using koorie_lw.


--on-port(-p)=['number']

server listening port.


--routes(-r)

instructs koorie to use routes, if not given, koorie will look for static files in public directory


--served-by(-sb)=['string']

instructs koorie to set a response header 'served-by' before sending the response. if --served-by is set to null, the header will not be set at all. default is set to koorie


--served-by-name(-sbn)=['string']

instructs koorie to rename the header name from 'served-by' to whatever is given to the flag.


--silenced(-s)

no log will be printed to stdout, no log will be saved to file using koorie_lw, except errors good for benchmarks. using logs, it's pretty expensive and reduces the performance of the server.


--to-index-html(-tih)

everything will be redirected to www.your-domain.com/index.html in case a javascript library like solidjs|react is running.


--watch(-w)

watch the routes directory for changes and reload the server routes. automated with chokidar If --activate-socket is given contemporary with --watch, the chokidar interface will be deactivated.


route

Command to administrate routes.

not complete yet.

#this command will create a file in ./src/route
koorie route --add=index

route flags

--add(-a)=['string']

add a route default typescript in .src/route folder


--remove(-r)=['string']

remove a route from .src/routes[typescript] directory and ./routes[javascript] directory


log

Command to check log files.

not complete yet.

#this command will list log files, if any.
koorie log --list

log flags

--checkout(-c)=['number']

checkout the log file at the given id.
It is possible to retrieve the id by running the koorie log --list


--delete-log(-dl)=['number']

delete the log file at the given id. set id to -1 to delete all the log files at once


--entry(-e)=['number']

checkout the log file at the given id and given entry id.


--list(-l)

Lists all the log files if any. Given a number as id related to the date they have been created.
Logs are written daily.


simple usage of the log command
koorie log --list #maybe there are many files but let's assume we want the id 1
koorie log --checkout=1 #to find the entry scroll down.
koorie log --checkout=1 --entry=26 
# it will show the detail of the log entry at 24 
# of file with id 1

socket

socket interface.

ℹ︎ flags --pid OR --name are required to connect and administrate the server through socket.
flags that are required to run giving the --pid OR --name flag

  • --forked-workers(-fw)
  • --refresh-routes(-rr)

to activate the interface run the command

#this command spin-up a server with socket activate.
koorie spin-up --activate-socket

the output will look similar to the one below.

----------------------------------------------------
 ⌖ socket active ⌖ 13058
----------------------------------------------------
koorie @ pid->13058 up and rocking
Koorie ♠ single instance
----------------------------------------------------
koorie your browser here ⬇ ︎
http://localhost:3001
----------------------------------------------------

koorie socket --pid=13058 --forked-workers

due to the point that there aren't any forked workers, the output will look similar to the one below.

receiving

{}


done

closed

socket flags

--find-socket(-fs)

Lists all the available sockets.
(ℹ)︎ some of them may be inactive.

--lost-socks to list all the sockets and see which one is active.


--forked-workers(-fw)

Lists all the forked workers and their status.
(ℹ︎) some of them may be dead.


--lost-socks(-ls)

Lists all the sockets and their status.
(ℹ︎) some of them may be inactive and being deleted while executing the command.


--name=['string']

when --activate-socket-name is given to start the server, use the given name followed by the PID of the koorie process.


--pid=['number']

when --activate-socket is given to start the server, use the PID of the koorie process.


--refresh-routes(-rr)

Adding routes without restarting the server.
Route collection will be emptied and populated again.
If the server is started with --fork all the workers will be killed and then forked again.


Routes


Koorie Module


Examples


JetBrains OSS License


I want to thank JetBrains to grant me the Open Source Software license for all their products. This opportunity gives me strength to keep on going with my studies and personal project.
To learn more about this opportunity, have a look at Licenses for Open Source Development - Community Support.

Thank you


Contacts


Package Sidebar

Install

npm i koorie

Weekly Downloads

3

Version

2.4.58

License

Apache-2.0

Unpacked Size

242 kB

Total Files

96

Last publish

Collaborators

  • simonedelpopolo_