Comparing version 0.0.2 to 0.2.1
{ | ||
"name": "vbel2", | ||
"version": "0.0.2", | ||
"version": "0.2.1", | ||
"description": "An opiniated back-end framework", | ||
@@ -9,2 +9,3 @@ "main": "index.js", | ||
}, | ||
"repository": "vanyle/vbel2", | ||
"keywords": [ | ||
@@ -19,2 +20,5 @@ "back-end", | ||
], | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
}, | ||
"author": "vanyle", | ||
@@ -21,0 +25,0 @@ "license": "MIT", |
# VBel2 | ||
VBel2 helps you quickly build complex APIs that easily integrate with your frontend. | ||
VBel2 helps you quickly build complex APIs that easily integrate with your frontend / existing backend. | ||
Think of it as Django but in Javascript, more lightweight and API focused. | ||
## Getting Started | ||
Use the following command | ||
```bash | ||
npm install vbel2 | ||
``` | ||
Minimal example: | ||
```js | ||
const VBel = require('vbel2'); | ||
const http = require('http'); | ||
let vbel = new VBel(); | ||
// Define endpoints | ||
vbel.endpoint("hello", {name:{"type":"string"}}, (obj,req,res) => { | ||
vbel.sendSuccess(`Hello ${obj.name}`); | ||
}); | ||
vbel.endpoint("bye", {name:{"type":"string"}}, (obj,req,res) => { | ||
vbel.sendSuccess(`Goodbye ${obj.name}`); | ||
}); | ||
vbel.compile(); // call compile before use | ||
let server = http.createServer({},vbel); | ||
server.listen(8080,() => { | ||
console.log("http://localhost:8080") | ||
}); | ||
``` | ||
## Overview | ||
VBel2 stands for Vanyle's BackEnd Library 2. It is a framework to build backends in NodeJS. VBel2 allows you to quickly build complex websites with minimal effort for your backend. | ||
VBel2 stands for Vanyle's BackEnd Library 2. It is a framework to build backends in Node.js. VBel2 allows you to quickly build complex websites with minimal effort for your backend. | ||
@@ -28,3 +66,3 @@ Most website are just an interface between a user and a database. The only job of the backend is to make sure that the users have proper authorizations to read or edit the database. It's from this observation that VBel2 was built. | ||
Let's say you have a nodejs application built with express and you want to add a new endpoint. | ||
Let's say you have a node.js application built with express and you want to add a new endpoint. | ||
For example, an endpoint that returns a random number from the server. | ||
@@ -49,3 +87,3 @@ | ||
let nbr = Math.random() * (obj.max - obj.min) + obj.min; | ||
vbel.sendResult(res,nbr); | ||
vbel.sendSuccess(res,nbr); | ||
} | ||
@@ -52,0 +90,0 @@ ); |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
76040
10
276