HTTP | Config & Commands
Adding HTTP Module
To integrate the HTTP Module into your framework, follow these steps:
Configuration
Open the
app/Config.jsfile.Add the following lines to configure the HTTP Module:
http: {
module: require("etherial/components/http").Http,
config: {
port: process.env.HTTP_PORT,
routes: [process_path("routes")],
},
},Customize the configuration parameters according to your specific setup. Here's a description of each parameter:
HTTP Configuration Parameters
port: The port number on which your HTTP server will listen (e.g., 3000).routes: An array of paths to the directory where your HTTP routes are located. You can customize this to fit your project structure.
Save the
app/Config.jsfile.
Routes Configuration
For the HTTP Module to work effectively, you need to define your HTTP routes. These routes should be stored in a directory specified in the routes parameter of the configuration.
Here's an example directory structure for your routes:
In the example above, you have two subdirectories: api and web, each containing route files for different parts of your application. You can organize your routes as needed.
That's it! You have successfully added the HTTP Module to Etherial and configured it for use. Make sure to customize the configuration parameters and organize your routes according to your specific project requirements.
Commands
No commands yet
Last updated
Was this helpful?