A file based routing framework for creating javascript backends.
-
File Based: ripazha doesn't have explicit api routes, rather the request handler to be loaded is inferred automatically by ripazha based on request's path and request's http verb.
-
HTTP based: Based on the javascript's default http module.
npm install ripazha
- In your project directory create an
index.js
file, with following content:
const ripazha = require("ripazha");
const PORT = 3000;
const app = new openpress(PORT, () => {
console.log("server running on PORT ", PORT);
});
- Create a folder at the same location as index.js, say
/users
- Create a file called
user.js
in/users
- From
user.js
export a function calledget
, such as:
exports.get = (req, res) => {
res.send("Hello, from ripazha!")
}
- Your api is ready. Start your
ripazha
app withnode index.js
and send aGET
request to/users/user
.