Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/

#built folder
built/
#package-lock.json file
package-lock.json

#vscode file
.vscode/
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Backend-mongoDB

Backend microservices api demo.
Essential features of login panel: User Registration , User Login, Forgot Password, Update Password; all done in Node.js with Express and MongoDB.

**User Authentication** enabled using [Passport](http://www.passportjs.org/)

**Role Based Access Control** on the routes and can be configured accroding to need to provide limited access based on the role of user.

## Run
1. Install dependencies ``` npm install ```
2. Configure MongoDB uri in ``` config/development.ts ```
3. Get SendGrid API Key from [SendGrid](https://sendgrid.com) and set it in ``` .env ``` file
4. *(Optional)* Default role is user and you can customize acl in ``` src/app/config/nacl.json ```
5. Run ``` tsc ``` in your terminal to compile the code
6. Run ``` node built/app.js ``` to run the project

[Postman](https://www.getpostman.com/) is recommended to send various requests e.g. GET, POST, etc.

* Register user by ``` http:localhost:9000/api/user/register ``` and you will see the user stored in MongoDB

* Now, you can try various other methods such as Forgot Password, Update Password and play around with other custom routes.

* You can perform authentication using ``` auth/ ``` routes.

* You can also query the stored data in database using ``` api/query/ ``` routes.

### References
* For learning more about ACL library used here: [express-acl](https://www.npmjs.com/package/express-acl)
* Library used for [pagination](https://www.npmjs.com/package/mongoose-paginate)


2 changes: 0 additions & 2 deletions built/api/user/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
var express = require("express");
var controller = require("./user.controller");
var auth = require("../../auth/auth.service");
Expand All @@ -15,5 +14,4 @@ router.post('/verifytoken', controller.verifytoken);
router.post('/updatepassword', auth.isAuthenticated(), controller.updatePassword);
/* For mobile side */
router.post('/upload/avatar', auth.isAuthenticated(), upload.single('file'), controller.uploadpic);
/* END */
module.exports = router;
Loading