Giter Site home page Giter Site logo

chat-server's Introduction

Chat Server

Backend for React Native Chat App

Table of Contents

About

Chat server is the backend for React Native Chat App.

I have hosted the service on Heroku using Express Web Framework.

The backend is composed of two parts:

  • Socket-io server api
  • Static server for Register page

Website

The website Contains a form for users to register for the app. The form makes use of VueJs.

Register form

Due to VueJs, the form relies on JavaScript. Hence, the backend will deliver polyfills if the browser requires it.

Database

The backend connects to a nosql MongoDB database hosted on MLab. It is interfaced with Mongoose.

Installation

Local

Prerequisites
  • Nodejs
  • npm or yarn
  • mongodb

Initialize package manager

yarn

Build webpack bundle

yarn build

Start server

yarn start

Heroku

Prerequisites
  • Nodejs
  • npm or yarn
  • herokuCLI

Initialize the project as a git repo, then commit.

git init

git add .

git commit -m 'first'

Create a heroku app. If you haven't setup Heroku, this is a good tutorial.

heroku create

Check that heroku exists in the remotes. If not, double check the tutorial.

git remote -v

Push the respo to heroku

git push heroku master

Next, we need to connect out app to a database.

heroku addons:create mongolab

Copy the value for the key MONGODB_URL, and add it to the key DB_URL.

heroku config

heroku config:set DB_URL=copied_value

Generate random key, about 20 characters long. This Site is a good place. You want to maximize the variability, so included capitals and numbers.

The key is used for authentication, so don't put a weak string like secret.

Then set the value JWT_KEY to the random string

heroku config:set JWT_KEY=random_string

Then reboot

heroku reboot

Everything should be working. Open the webpage and navigate to /register to check if everything is working.

heroku open

chat-server's People

Contributors

thecallum avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.