yarn add @tobshub/tobspress
OR
npm i @tobshub/tobspress
A simple example is available here.
Create a new instance of Tobspress
import Tobspress from "@tobshub/tobspress";
const app = new Tobspress();
app.listen(4000);
The Tobspress
instance exposes method that will be familiar if you have used a similar library.
import Tobspress, {TobspressRouter} from "@tobshub/tobspress";
const app = new Tobspress();
const helloRouter = new TobspressRouter();
helloRouter.get("/world", (req, res) => {
res.send("hello world");
});
app.use(
"/hello",
(req, res) => res.send("hello"),
helloRouter
);
app.use("/", (req, res) => {
res.sendFile("public/index.html");
});
app.listen(4000);