slope.js
v1.2.0
Published
a node.js webserver library
Downloads
1
Maintainers
Readme
Introduction
slope is an object-oriented zero-dependency class-driven webserver library written in Node.js. It allows the user high-level access to numerous functions that allow the user to render HTML documents, send files, return JSON data, and much more.
In short, it allows you to create a webserver like this:
const Slope = require("slope.js");
const server = new Slope.Server();
server.routes.add("/", (client, result) => {
result.send("Hello, world!");
});
server.run();
Try it -- this is completely working Slope code! If you want to dynamically load routes, you can do something like what was described in discussion #8:
const Slope = require("slope.js");
const server = new Slope.Server();
server.routes.add("*", (client, result) => {
try {
require(`./routes/${client.url}`)(client, result);
} catch (error) {
Slope.raiseErrors(404);
}
});
server.run();
Install
Install and update using npm:
npm i slope.js
Alternatively, for the latest and most unstable version, clone with GitHub:
gh repo clone wibbuffey/slope # download slope
cd slope # enter the directory
Links
If you want to follow the project or ask for help:
- Source Code: https://github.com/wibbuffey/slope
- Issue Tracker: https://github.com/wibbuffey/slope/issues
- Discussions: https://github.com/wibbuffey/slope/discussions
- Documentation: https://wibbuffey.github.io/slope
If you want to contribute:
- Security Policy: SECURITY.md
- Contributing Guide: CONTRIBUTING.md
- Code of Conduct: CODE_OF_CONDUCT.md
- License (MIT): LICENSE.md