ujjwalguptaofficial / fortjs Goto Github PK
View Code? Open in Web Editor NEWA feature-rich Node.js web framework designed for building powerful, scalable, and maintainable web applications.
Home Page: https://fortjs.net/
License: MIT License
A feature-rich Node.js web framework designed for building powerful, scalable, and maintainable web applications.
Home Page: https://fortjs.net/
License: MIT License
Hello i need help,
I would like use many checkbox but when i click to checkbox one and checkbox two is not working.
I have a form with a lot of radio buttons they are all in classes
The problem is that when I click on the first radio button it works but when I click on the second one and well the Progress bar doesn't advance.
and I can have forms with 10 checkboxes as 6 is random how to make it automatic?
[]( check -->https://jsfiddle.net/alex447/m6juh0dx/19/ )
` function flash(){
function cback(e) {
var t = [];
for (var n = inputs.length; n--;) {
if (!inputs[n].value.length) t.push(inputs[n]);
}
var r = t.length;
var i = inputs.length;
var s = document.querySelectorAll(".top");
for (var o = s.length; o--;) {
s[o].style.width = 100 - r / i * 100 + "%";
s[o].style.background = cols[i-r-1];
}
}
var forms = document.querySelectorAll(".form"),
inputs = [];
for (var i = forms.length; i--;) {
var els = forms[i].querySelectorAll("input, textarea, select");
for (var j = els.length; j--;) {
if (els[j].type != "button" && els[j].type != "submit") {
inputs.push(els[j]);
els[j].addEventListener("input", cback, false);
}
}
}
var cols = ["#1ABC9C","#EC7063","#3498DB"];
}
function gradient(){
function cback(e) {
var t = [];
for (var n = inputs.length; n--;) {
if (!inputs[n].value.length) t.push(inputs[n]);
}
var r = t.length;
var i = inputs.length;
var s = document.querySelectorAll(".top");
for (var o = s.length; o--;) {
s[o].style.width = 100 - r / i * 100 + "%";
}
}
var forms = document.querySelectorAll(".form"),
inputs = [];
for (var i = forms.length; i--;) {
var els = forms[i].querySelectorAll("input, textarea, select");
for (var j = els.length; j--;) {
if (els[j].type != "button" && els[j].type != "submit") {
inputs.push(els[j]);
els[j].addEventListener("input", cback, false);
}
}
}
}
function sections(){
function cback(e) {
var t = [];
for (var n = inputs.length; n--;) {
if (!inputs[n].value.length) t.push(inputs[n]);
}
var r = t.length;
var i = inputs.length;
var s = document.querySelectorAll(".top");
for (var o = s.length; o--;) {
s[o].style.width = 100 - r / i * 100 + "%";
}
}
var forms = document.querySelectorAll(".form"),
inputs = [];
for (var i = forms.length; i--;) {
var els = forms[i].querySelectorAll("input, radio, select");
for (var j = els.length; j--;) {
if (els[j].type != "button" && els[j].type != "submit") {
inputs.push(els[j]);
els[j].addEventListener("input", cback, false);
}
}
}
function generateCSSGradient(colours) {
var l = colours.length, i;
for( i=0; i<l; i++) colours[i] = colours[i].join(" ");
return "linear-gradient( to right, "+colours.join(", ")+")";
}
var cols = [
["#1ABC9C","0%"],
["#1ABC9C","33.3%"],
["#EC7063","33.3%"], // note same percentage - this gives a crisp change
["#EC7063","66.6%"],
["#3498DB","66.6%"],
["#3498DB","100%"]
];
document.getElementsByClassName('.top').innerHTML = '
var window_width = window.innerWidth + "px";
document.querySelector(".colors").style.width = window_width;
};`
Thanks
it("Registers a new user", async (done) => {
controller.initialize({ data: { creds: { email: "[email protected]", firstName: "register", lastName: "test", password: "test", role: "GUEST" } } })
await controller.registerUser()
const result = await User.find()
expect(result.length).toBe(1)
const result = await User.find({email: "[email protected]"})
done()
})
value of body in worker:
{ }
https://github.com/ujjwalguptaofficial/fortjs/blob/master/src/handlers/request_handler.ts#L111
I consider putting a huge chunk of lines of code inside a try catch
an anti-pattern.
On this line https://github.com/ujjwalguptaofficial/fortjs/blob/master/src/handlers/request_handler.ts#L185
async handlePostData() {
if (this.request.method === HTTP_METHOD.Get) {
this.body = {};
}
else if (Global.shouldParsePost === true) {
try {
this.body = await this.parsePostData();
}
catch (ex) {
return Promise.reject(ex);
}
}
}
Things to know about Promises:
Promise.reject(Promise.reject("error"))
is the same as Promise.reject("error")
and Promise.resolve(Promise.resolve("value"))
is the same as Promise.resolve("value")
Promise.resolve(Promise.reject("error"))
is the same as Promise.reject("error")
Promise.resolve
and any thrown value in a Promise.reject
So inside the else if it could be rewritten
try {
this.body = await this.parsePostData();
}
catch (ex) {
throw ex;
}
catch (x) { throw x;}
So even simpler
`this.body = await this.parsePostData();
The code will execute the same. Next steps fix other places that use this antipattern
Currently the HttpResult has a property "responseData" which is of type any, This feature request is to add type support in HttpResult so that the user of the library could pass the DTO class type for the "responseData" object.
Though this is not an industry standards, hosting of the server on https might be required for demonstration purposes.
I have 3 services right now that I need to inject into my controller. Problem is when I use a third one it'll just stop injecting all together.
Example:
getOrderService: GetOrderService
updateOrderService: UpdateOrderService
createOrderService: CreateOrderService
constructor(
@Singleton(CreateOrderService) createOrderService: CreateOrderService,
@Singleton(GetOrderService) getOrderService: GetOrderService,
@Singleton(UpdateOrderService) updateOrderService: UpdateOrderService) {
super();
this.getOrderService = getOrderService;
this.createOrderService = createOrderService;
this.updateOrderService = updateOrderService;
}
returns on every request:
internal server error message : this.getOrderService.<<whatever.function.is.called>> is not a function stacktrace: TypeError: this.getOrderService.<<whatever.function.is.called>> is not a function at OrderController. (C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:285:60) at step (C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:221:23) at Object.next (C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:202:53) at C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:196:71 at new Promise () at ./controllers/order_controller.ts.__awaiter (C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:192:12) at OrderController../controllers/order_controller.ts.OrderController.<<whatever.function.is.called>>(C:\Users\weltert\Desktop\pba-api-test\pba-api\bin\app.js:281:16) at RequestHandler.module.exports.RequestHandler.runController_ (C:\Users\weltert\Desktop\pba-api-test\pba-api\node_modules\fortjs\dist\fort.js:2162:67) at RequestHandler. (C:\Users\weltert\Desktop\pba-api-test\pba-api\node_modules\fortjs\dist\fort.js:2322:34) at step (C:\Users\weltert\Desktop\pba-api-test\pba-api\node_modules\fortjs\dist\fort.js:2069:23) at Object.next (C:\Users\weltert\Desktop\pba-api-test\pba-api\node_modules\fortjs\dist\fort.js:2050:53) at fulfilled (C:\Users\weltert\Desktop\pba-api-test\pba-api\node_modules\fortjs\dist\fort.js:2041:58)
But if I remove 1 singleton (doesn't matter which):
getOrderService: GetOrderService
updateOrderService: UpdateOrderService
constructor(
@Singleton(CreateOrderService) createOrderService: CreateOrderService,
@Singleton(GetOrderService) getOrderService: GetOrderService) {
super();
this.getOrderService = getOrderService;
this.createOrderService = createOrderService;
}
It'll work just fine.
Wall's Outgoing function is the right place to create to create a generic 500 caught exception handler in fortjs, however the as per the current implementation the status code of the response is not available in response object available in the Wall.
Request you to add status code to the response object.
Doc page - fortjs.info is not working.
Allow the methods of ErrorHandler class to return Promise<HttpResult>
rather than Promise<string>
. This gives the flexibility to the users to either return a jsonResult or a textResult.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.