webserver-framework/README.md

32 lines
1.5 KiB
Markdown
Raw Normal View History

2022-11-06 18:36:13 +01:00
# Navy's webserver framework
2022-11-09 13:56:55 +01:00
A template repository for creating Node.js based webservers with sharding.
Main repository: https://git.corgi.wtf/Navy.gif/webserver-framework
2022-11-06 18:36:13 +01:00
2022-11-09 20:43:22 +01:00
## How to
Using the template
- Clone the repository `git clone https://git.corgi.wtf/Navy.gif/webserver-framework <project name>`
- Change the original remote name to `git remote rename origin upstream`.
- Disable pushing to the upstream remote `git remote set-url --push upstream no_push`.
- Add your own remote `git remote add <remote name> <repository url>`
Fetching the upstream changes
- Fetch the the remotes `git fetch`.
- Preview the changes `git log -p HEAD..upstream/master`
- Merge changes to the current branch `git merge upstream/master`.
2022-11-06 18:36:13 +01:00
## Main components
**Controller:** `/src/controller/Controller.js`
Master process, orchestrates the whole program. Takes care of starting up the shards and communication with them.
**Shard.js:** `/src/controller/Shard.js`
Manages the forked processes. Essentially a wrapper for ChildProcess.
**Server.js:** `/src/server/Server.js`
2022-11-09 13:56:55 +01:00
Main component that runs on the forked processes. Expects a message with a `_start` property with the startup options to be sent.
## "Lesser" components
**Authenticator:** `/src/server/middleware/Authenticator.js`
Takes care of sessions, authentication and authorisation, relies on an implementation of `AbstractUserDatabase.js`.
**UserDatabase:** `/src/server/components/UserDatabase.js`
Implementation of `AbstractUserDatabase.js`, takes care of user management.