Ghost Service Loader
Doc Sections |
---|
Getting Started |
Making Changes |
Included Services |
Get the Code
Usage
1. Require
const GhostServiceLoader = ;// Easy enough
2. Init
const serviceLoader = ; // see README.md in config folder
3. Usage
const myService = ;serviceLoader; // later on in another fileconst serviceLoader = ; // no need to pass config in again after initconst myService = serviceLoader;
Included Services
Authorization
const Config = ;const GhostServiceLoader = ;const serviceLoader = const authorizationService = serviceLoader; // use the serviceauthorizationService;
ElasticSearch Client
const Config = ;const GhostServiceLoader = ;const serviceLoader = const elasticSearchClient = serviceLoader; // use the servicereturn { elasticSearchClientindices}
const Config = ;const GhostServiceLoader = ;const serviceLoader = const emailService = serviceLoader; // use the serviceemailService;
Logger
const Config = ;const GhostServiceLoader = ;const serviceLoader = const logger = serviceLoader; // use the servicelogger
ModelScope
const Config = ;const GhostServiceLoader = ;const serviceLoader = const modelScopeService = serviceLoader; // use the servicemodelScopeService;
Permission
const Config = ;const GhostServiceLoader = ;const serviceLoader = const permissionService = serviceLoader; // use the servicepermissionService;
Profile
const Config = ;const GhostServiceLoader = ;const serviceLoader = const profileService = serviceLoader; // use the serviceprofileService;
ResetToken
const Config = ;const GhostServiceLoader = ;const serviceLoader = const resetTokenService = serviceLoader; // use the serviceresetTokenService;
Role
const Config = ;const GhostServiceLoader = ;const serviceLoader = const roleService = serviceLoader; // use the serviceroleService;
RolePermission
const Config = ;const GhostServiceLoader = ;const serviceLoader = const rolePermissionService = serviceLoader; // use the servicerolePermissionService;
User
const Config = ;const GhostServiceLoader = ;const serviceLoader = const userService = serviceLoader; // use the serviceuserService;
UserPermission
const Config = ;const GhostServiceLoader = ;const serviceLoader = const userPermissionService = serviceLoader; // use the serviceuserPermissionService;
UserRole
const Config = ;const GhostServiceLoader = ;const serviceLoader = const userRoleService = serviceLoader; // use the serviceuserRoleService;
Making Changes
If you have never used Git, search around online to get a grounding. But here are the basic commands you will need to use to actually push code to our repository, with a little bit of Git theory to explain what's going on.
- First make sure you have the most current version of the codebase. In your terminal window, navigate to the project root. Type
git checkout master
to checkout the master branch. git pull origin master
will update master with any new changes.git checkout -b feature/[NEW_FEATURE_NAME]
this will create a new branch (called feature/NEW_FEATURE_NAME, or whatever you want). Your branch names should be descriptive, but short. For example, if I want to create a cart on my branch, I might call it "feature/cart" (after the object) or "feature/checkout" (after the functionality).- You can run
git branch
at any time to see which branch you're on and what branches you have locally. - Write some code. If you ever want to see which files you've changed, added, or deleted you can run
git status
- When you are satisfied with your changes, make a commit by executing
git commit -am [YOUR_COMMIT_MESSAGE]
. The -a attribute tells Git to commit all changed files. If you don't want to commit all of them, you'll have to type the names of the files. The -m is required; Git needs commit messages. Try to be descriptive, maybe your first commit message will be "store skeleton", the next will be "product page", etc. NOTEgit commit -a
will not commit any new files since they are not part of Git yet. If you have new files you will need to rungit add .
before the above commands ("." means "all"). - Once the code is committed to your branch, your branch is ready to go. Now we just need to release it into the internet and tell everyone else that we want to combine this branch with the master branch. Execute
git push origin [BRANCH_NAME]
. Here, origin represents our Bitbucket repository. Rungit remote -v
to see your repository aliases. - Now we create a pull request on github - in other words, a request to the other developers that we want our code to be merged into the application. In the left sidebar, click Pull Requests > Create Pull Request. The branch on the left should be the branch you were just working on i.e. the one we want to merge into the app. The branch on the right should be master. Make a descriptive title so we know what the pull request is for, and add the necessary reviewers.
- Click "Create Pull Request" and wait for us to review your code.
We follow the git branching model outlined in this blog post
.