# Login Signup loopback4

The login_signup_node module is a Node.js based loopback script and it provides a fastest way to create user signup and login services.

## Pre-requisites

Node.js , and the platform-specific tools needed to compile native NPM modules (which you may already have):

## Installation

To install the login_signup_node module, simply run the following command within your app's directory:

```sh
npm install  login_signup_node --save
```

## Development

```sh
var app = require("login_signup_node");
```

### Database Configuration:

```sh
const databaseconfig = {
	name: 'user',
	connector: 'mongodb',
	url: '',
	host: 'localhost',
	port: 27017,
	user: '',
	password: '',
	database: 'getoverit',
};

app.dbconfig.setDataSource(databaseconfig);
```

##### Note: email, username and password in schema are must. but you can declare any number of fields you can. id feild is generated by default for every signup.

#### Must follow below model properties configuration for payment integration with Authorize.net

### Model Configuration:

```sh
const schema = {
	properties: [
		{ type: 'string', required: false, name: 'email' },
		{ type: 'string', required: false, name: 'password' },
		{ type: 'string', required: false, name: 'username' },
		{ type: 'number', required: false, name: 'phone' },
	],
};
app.generateModel.generate(schema);
```

#### Include following to start app:

```sh
app.startServer();
```

#### Run following in your terminal to start the APP:

```sh
 node script.js
```

Verify the deployment by navigating to your server address in your preferred browser.

```sh
http://localhost:8083/ping
```

Example for signup

```sh
http://localhost:8083/users/signup

     {
     "email":"wagaf",
      "password":"swarup123s4",
      "username":"swarup",
      "phone":"8977924082"
      }
```

Example for login

```sh
http://localhost:8083/users/login
{
     "email":"wagaf",
      "password":"swarup123s4"
      }
```

#Licence
MIT
