2.1.1 • Published 2 years ago

codex-web-server v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Codex Web Server

This guide will walk you through the process of setting up and running a Codex Web Server.

Installation

First, you need to install the npm package. Run the following command in your terminal:

npm i codex-web-server

Usage

After installation, you can start using the Codex Web Server in your project. First, import the module: const codex = require('codex-web-server'); Then, instantiate a server object and specify if you want to enable compression: const server = new codex(true);

Routing

To define routes for your server, use the createRoute method(). This method takes three parameters: the virtual path, the actual path, and the content type. Here's an example: server.createRoute('/', 'index.html', 'text/html');

In this example, when users navigate to the root URL ('/'), they will be served the index.html file with a content type of 'text/html'.

Starting the Server

Finally, to start the server, call the startServer() method with the port number as an argument. For example, to start the server on port 8000, run:

server.startServer(8000); Now your Codex Web Server should be up and running!

2.1.1

2 years ago

2.1.0

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago