|
| 1 | +# Rest api for login-signup-viewprofile-logout |
| 2 | + |
| 3 | +This project consist of rest API's build in node-js using express and mongo-db for doing login, signup as well as to show the profile of the user and then finally logging out the user |
| 4 | +Here first simple sign-up route has been created, Here user have to provide his just email and password, you can change this in user schema according |
| 5 | +to your need, one email can be registered only once, if he tried to register again auth failed will be shown, then for logging up he has to |
| 6 | +provide correct credentials for login,if any of the 2 things is wrong he won't be able to login, then i am generating here a jwt token, |
| 7 | +which will only expire when the person logged out. |
| 8 | + |
| 9 | +--- |
| 10 | +## Requirements |
| 11 | + |
| 12 | +For development, you will need Node.js and a node global package, Yarn, installed in your environement and many other packages also which are stated further |
| 13 | + |
| 14 | +### Node |
| 15 | +- #### Node installation on Windows |
| 16 | + |
| 17 | + Just go on [official Node.js website](https://nodejs.org/) and download the installer. |
| 18 | +Also, be sure to have `git` available in your PATH, `npm` might need it (You can find git [here](https://git-scm.com/)). |
| 19 | + |
| 20 | +- #### Node installation on Ubuntu |
| 21 | + |
| 22 | + You can install nodejs and npm easily with apt install, just run the following commands. |
| 23 | + |
| 24 | + $ sudo apt install nodejs |
| 25 | + $ sudo apt install npm |
| 26 | + |
| 27 | +- #### Other Operating Systems |
| 28 | + You can find more information about the installation on the [official Node.js website](https://nodejs.org/) and the [official NPM website](https://npmjs.org/). |
| 29 | + |
| 30 | +If the installation was successful, you should be able to run the following command. |
| 31 | + |
| 32 | + $ node --version |
| 33 | + v8.11.3 |
| 34 | + |
| 35 | + $ npm --version |
| 36 | + 6.1.0 |
| 37 | + |
| 38 | +If you need to update `npm`, you can make it using `npm`! Cool right? After running the following command, just open again the command line and be happy. |
| 39 | + |
| 40 | + $ npm install npm -g |
| 41 | + |
| 42 | +### |
| 43 | +### Yarn installation |
| 44 | + After installing node, this project will need yarn too, so just run the following command. |
| 45 | + |
| 46 | + $ npm install -g yarn |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Install |
| 51 | + |
| 52 | + $ git clone https://github.com/YOUR_USERNAME/PROJECT_TITLE |
| 53 | + $ cd node-js-components |
| 54 | + $ cd login, sign-up rst api's |
| 55 | + |
| 56 | +## packages you need to install |
| 57 | +``` |
| 58 | + express |
| 59 | + mongoose |
| 60 | + body-parser |
| 61 | + cookie-parser |
| 62 | + bcrypt |
| 63 | +``` |
| 64 | +for installing the above packages you have to run the below command |
| 65 | + |
| 66 | +``` |
| 67 | + npm install <package_name> |
| 68 | + |
| 69 | +``` |
| 70 | + |
| 71 | +## Running the project |
| 72 | + |
| 73 | + $ yarn start |
| 74 | + |
| 75 | +## Simple build for production |
| 76 | + |
| 77 | + $ yarn build |
0 commit comments