0.0.9 • Published 7 years ago
simple-framework-core v0.0.9
simple-framework-core
Little tool to create a simple Framework with namespace from Dependancy The program simply loading dependancies files from a path and eval them, then return an object witch is the framework.
It provide the entire Framework and the namespace() function inside the Dependancy files.
installation :
npm i --save simple-framework-core
##Example of use :
Let say you have to create a little user management system. So first you create a User entity and a User Factory
./Framework/UserEntity.js
class UsersEntity {
constructor(username, password) {
this.username = username
this.password = password
}
}
namespace("Users").Entity = UsersEntity
./Framework/UserFactory.js
class UsersFactory {
constructor() {
// whatever you need
}
createNewUser() {
return new Framework.Users.Entity()
}
}
namespace("Users").Factory = new UsersFactory()
Then use your Framework like :
./index.js
let Framework = new (require('simple-framework-core'))('./Framework')
let newUser = Framework.Users.Factory.createNewUser("Morgiver", "1234")
console.log(newUser)
Enjoy ! o/
ps: Sorry for my bad english, i'm not a natural english speaker.