Node.js is the only requirement.
- Clone the repository
- In each project inside
services/runnpm installto download all the dependencies.
Note: this command should be run again every time you install/delete a package (which should not happen a lot)
In each project, run node index.js so the server will start listening to requests.
In the services/ folder you will find all the projects that makes your website. Each subfolder is a node.js project
that contains:
- A
package.json(and potentially somenode_modules) - An
index.jsfile which is an HTTP server able to received requests - Some logic used for the service to work correctly
At the start of your project, there are 2 services:
gatewaywhich is the clients' entry point. It receives all the requests and then redirect them to the correct service.fileswhich is used to serve files. It is where your front files will go
To create a new service:
- Create a new folder inside
services/ - Run
npm init -yinside the created folder - Create an
index.jscontaining an HTTP server (and listening to a new port) - Add any logic you want
To call a service:
2 external packages are allowed to transfer a request:
http-proxyallows you to easily transfer a request "as-is" to another HTTP Server (you have an example in the gateway service)axiosto perform specific REST requests.