DEV Community

Jahongir Sobirov
Jahongir Sobirov

Posted on

3 1

Sphere.js creating http servers for beginners

What is Sphere.js?

Sphere.js is designed to create these simple http servers. So what is an http server? An HTTP server is a small and simple server that can be created in node.js. In Node.js, you can do this mainly through http, express.js and socket.io. It takes a lot of time to learn these. However, sphere.js is not like that. This framework is mainly recommended for beginners.

Using sphere.js

Let’s download this framework first and we will do this using github cli: gh repo clone Jahongir2007/sphere.js
Creating simple http server in Sphere.js:

const sphere = require("./sphere"); // importing sphere.js
const app = sphere; // creating sphere application
app.options({ // creating http server
   head: 200, // server head
   send: "Hello, world!", // getting text for http server
   listen: 8000 // listening http server
});
Enter fullscreen mode Exit fullscreen mode

Run this:

node test.js
Enter fullscreen mode Exit fullscreen mode

The result:
Alt Text

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more