Spurtcommerce Dev Team is Live on Discord for instant support

dimg1 dimg2 dimg3 dimg4 dimg5 dimg0
white-mask Connect Now cls

Installation

After Downloading your Api(spurt-api)folder,make sure the following Installations are required to run your api.

Nodejs Installation

First you need to install node 6.9.1 by using the below commands in your terminal.

    $ sudo apt-get update
    $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    $ sudo apt-get install nodejs
    $ sudo apt-get install build-essential

Forever Installation

You can use forever to run scripts continuously (whether it is written in node.js or not).

$ sudo npm install -g forever

Apache Installation

$ sudo apt-get install apache2

Mysql Installation


    $ sudo apt-get update
    $ sudo apt-get install mysql-server
    $ sudo mysql_server_installation
    $ mysql_install_db 

File Transfer

Your Downloaded Files(spurtcommerce) are transferred from local server to remote server using Filezilla FTP.

FileZilla Installation commands:

$  sudo add-apt-repository ppa:n-muench/programs-ppa
$ sudo apt-get update
$ sudo apt-get install filezilla

After completed your Filezilla Installations, upload your files by following the below steps

Upload file://Filezilla/Edit/Preferences/SFTP

Upload your files here.

Mysql Connection

Enter your mysql root:

 $ mysql -u root -p

Import your mysql database into Remote Server

$ mysql -u root -p spurtcommerce <  /home/ubuntu/ecommerce.sql>

Now your database ecommerce.sql file will be transferred into Remote server successfully.

IP Forwarding & Port Forwarding

In order to allow requests on the standard HTTP port,First You must Forward your IP

IP Forwarding

Run the below command to see if you have ip Forwarding is enabled already or not.

$ cat /proc/sys/net/ipv4/ip_forward

If it returns 0, then IP forwarding is disabled,Then you must enable the changes made in sysctl.conf:

$ sudo vim /etc/sysctl.conf


$ sudo sysctl -p /etc/sysctl.conf

Once again check your ip forwarding is enabled or not

 $ cat /proc/sys/net/ipv4/ip_forward

It should return a 1 now.

IP Forwarding is successfully enabled

Port Forwarding

You need to change your apache port 80 to api port 8000, by using below commands,


  $ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8000
$ sudo iptables -A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
$ sudo iptables -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT

Path Specification

After finished your ip & port forwarding steps,you need to change your path to your api(spurt-api)

Go to the below path & changes are made.

$ spurtcommerce/spurt_api/server/middleware.json

 "files": {
"loopback#static": [
{
"paths": [
"/app"
],
"params": "$!../../spurt_front"
}


"files": {
"loopback#static": [
{
"paths": [
"/admin"
],
"params": "$!../../spurt_admin"
}
]
}

Running & Execution

To run your application, you need to do below steps,

$ cd spurtcommerce/spurt-api
$ node .

open below link in your browser

$ Web Server Listening at http://localhost:8000

If you want run your program continously, you need to start forever

$ forever start server/server.js