The Chat-u-lator is a web-based multi-user calculator. The results of the last 10 calculations are shown in reverse chronological order. The results are shown to all users and displayed in realtime. The Chat-u-lator utilizes the math.js library to perform calculations.
This is a simple demo that shows how to use Web sockets in a Node application. Please feel free to use as a foundation for your own projects.
- Install Node.js and npm if you have not done so already.
- Create an SQL database. ElephantSQL makes this super easy.
- Download this repository.
- Open a terminal window, and change to the root directory of the project.
- Enter
npm install
at the command line. - Set the environment variable
ConnectionString
to point to your SQL database. - Enter
node models/create-database-table.js
at the command line. - Enter
npm start
at the command line.
Here is an example of a connection string for a Postgres database.
$ export ConnectionString="postgres://username:password@db.example.com:5432/database"
I deployed this application on Amazon Elastic Beanstalk at http://tiny.cc/chatulator. I recommend using the command line interface. I will not include detailed instructions, but if I can figure it out, then you can too. I believe in you!!!