acumen-academy-main-api-v2 v1.0.8
AcumenAcademyMF (ACMF) - Center Restful Api for Acumen Academy Portal
Acumen Academy MF is a Node.js application built using Express js framework. The application purpose is to serve as the center API for ACUMEN ACADEMY
Requirements
To setup AcumenAcademyMF you will need
Node
It will run the application as a server
npm
The Javascript package manager
Git
To checkout the code from the repository
Setup
Make sure you have both Node.js and npm installed in your computer by checking its versions in your system
$ <program> -vClone ACMF repository.
$ git clone https://github.com/plusacumen/AcumenAcademyMFInstall ACMF package dependencies
$ npm installInstall globally Unit Tests performer mocha and Code Coverage plugin istambul
$ sudo npm install mocha istambul -g$ sudo npm install mocha istambul -gConfigure parameters by copying .sample-env to .env and update credentials.
$ cp .sample-env .envYou should be ready to run your application
$ npm run startServer should start and a message should be displayed to the console:
$ Acumen !!! ACMF Restful API running on http://localhost:3334Running UnitTests with code coverage
$ npm run testGenerate api docs
$ npm run docsRead API docs (only available after generated)
Open file /public/apidoc/generated/index.html in the browser
Test AAMF API
To test AAMF, both a Postman collection and environment are available in the postman folder:
docs/postman/AAMF.Staging.postman_environment.json docs/postman/AAMF.production.postman_collection.json
Authenticate user through SSO redirect
path : /ssoDebug on Visual Studio Code
It's easy to debug with Visual Studio Code both for unit tests and app run. Add a file named "launch.json" in .vscode hidden folder, at the root of your project. Paste the following content:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Mocha tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": ["-t", "10000", "test/**/*.spec.js"],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeArgs": ["--nolazy"],
"env": {
"NODE_ENV": "test"
},
"console": "internalConsole",
"outFiles": ["${workspaceRoot}"]
},
{
"name": "Debug Program",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app.js",
"env": {
"JWT_TOKEN": "i&AMjustfree847"
}
}
]
}Now, if you want to run the application in debug mode (Ctr+Shift+D), choose one of the two available configurations ("Debug Mocha tests" or "Debug Program") and play "Start Debugging". App will stop at your breakpoints.