1.0.6 • Published 2 years ago
@bulcane/api-maker v1.0.6
api-maker
api maker is a simple api creator. using express
Installation
npm install @bulcane/api-maker
Example
const api_maker = require("@bulcane/api-maker") //import the package
let api = new api_maker.Api();
api.runOn(3200); //run the api on the selected port
let data = {
name: "juan",
id: 1023021
} //the data you prefer to insert in the api
api.write(data); //write in the page your data
api.onStart("Api started") //the message left after the server is online
api.server.run(); //start the server (express)
Other examples
const api_maker = require("@bulcane/api-maker") //import the package
let api = new api_maker.Api();
api.runOn(3000); //run the api on the selected port
let data = {
name: "john",
id: "hello"
} //the json you prefer to insert in the api
api.write(data) //write in the page your data
api.onStart("SERVER START") //the message left after the server is online
let 2ndData = {
pro: true
}
api.newPage({
pageName: "helloworld",
data: 2ndData
})
//simple js example
if(1 < 30) {
api.write(data)
} else {
console.log("no")
}
api.server.run(); //run the server (express)