Skip to content

Deploy Backend Node.js and Express Server

<p align="center">
    <a href="https://cloud.ibm.com">
        <img src="https://cloud.ibm.com/media/docs/developer-appservice/resources/ibm-cloud.svg" height="100" alt="IBM Cloud">
    </a>
</p>

Install Node.js

If you already install Node.js please jump to Clone from Github

Download Node and Npm

Download your prefer version of Node.js

Check that you have node and npm installed

To check if you have Node.js installed, run this command in your terminal:

node -v

To confirm that you have npm installed you can run this command in your terminal:

npm -v

Clone from Github

clone the repository by runnning:

git clone https://github.com/IBM-AR-Greeting-Tool/AR_backend.git

now navigate to the project

cd AR_backend

Config your backend server

in /config open`index.js`

Configure the config of the database

db: {
        dialect: 'mysql',
        host: '************',
        username: '************',
        password: '************',
        database: '************',
        define: {
            charset: 'utf8',
            dialectOptions: {
                collate: 'utf8_general_ci',
            },
            timestamps: true,
        },
        timezone: '+08:00',
    },

in /utils open uploadOss.js

Configure the config of the Aliyun OSS

let client = new OSS({
    region: 'oss-eu-west-1',
    accessKeyId: '************',
    accessKeySecret: '************',
    bucket: 'ucl-greetings-card',
})

## Install the dependencies

# Install Dependencies
npm install

Run the application

Make sure:

  • Your current directory is the backend working directory.
  • You have run npm install to install all the dependencies.
  • Your conf is correctly configured.

Run:

node app.js

to start the server, once the server has started you will see similar output:

App listening on port ${port}!

You can also use a process manager such as forever to run the server persistently.

If you have forever installed, you can also use our launch script:

forever run app.js