This is readme and instructions how start using node backend bundle from Akveo. Backend bundle is integrated solution of Node Backend Code and Angular Frontend code. Backend code plays mostly API role, giving data to the client side as REST API.
-
install mongoDB locally or register mongoDB in some hosting. in case of local node run command:
mongod
in separate terminal -
setup connection to mongoDB in
config/default.js
db: {
url: 'mongodb://localhost:27017/bundle-node',
name: 'bundle-node',
},
Install and run the app
npm install
npm start
test that node api is running by opening http://localhost:3001/api
You can use these test users for application testing:
- [email protected] / 12345
- [email protected] / !2e4S
While developing node.js api we suggest to use npm run dev
command, because it runs nodemon
module to watch over changes and re-run node api automatically.
You can check API documentation by running api and accessing http://localhost:3001/api/swagger link.
To use swagger with token authentication please follow these steps:
- open swagger link
http://localhost:3001/api/swagger
while running api - expand
**Auth**
controller and openPOST /auth/login
action - click
try out
and put correct user info into loginDto field (there is sample in swagger). Clickexecute
- when received response with token, copy token
access_token
(ctrl+c) - click
Authorize
button. Paste there token in format:Bearer <token>
and clickAuthorize
- after UI was refreshed, you can try any requests, token will be added there