/catsvsdogs

Spaces vs Tabs? Cats vs Dogs? Take a vote!

Primary LanguageTypeScript

Cats vs. Dogs

This project was generated with the Dojo CLI & Dojo CLI create app command.

This app is a demo for a fun and not serious conference talk about JavaScript and tech debates and memes (e.g. tabs vs. spaces, classes vs. not), with the ultimate debate being whether we prefer cats or dogs.

It has been presented at HalfStack 2018 and the November 2018 Phoenix TypeScript meetup. Here are the slides for the Phoenix TypeScript presentation.

The Cats vs. Dogs app leverages modern Dojo, Web Animation, WebAudio, and more for this simple demo app.

Overview

This repository contains both the client and server for cats vs dogs located in their respective directories. The root directory of this project provides scripts applicable to the entire project.

Quick Start

  • run npm install to install all dependencies
  • to build the client run npm run build
  • to start the server run npm run start
  • open http://localhost:3000

Deploy

CatsvsDogs can be deployed to Now using npm run deploy:now. You will need to have an account and be logged in using the now CLI.

The client can also be deployed to Github pages using npm run deploy:gh

Docker

Build the image

docker build -t "catsvsdogs" .

Run the image

docker run -p 3000 --name versus catsvsdogs

Debug the image

docker exec -it versus /bin/bash

Client

The client, located under the client directory, is built using Dojo CLI.

Build

Then run dojo build --mode dist (the mode option defaults to dist) to create a production build for the project. The built artifacts will be stored in the output/dist directory.

Development Build

Run dojo build --mode dev to create a development build for the project. The built artifacts will be stored in the output/dev directory.

Development server

Run dojo build --mode dev --watch memory --serve to create an in memory development build and start a development server with hot reload. By default the server runs on port 9999, navigate to http://localhost:9999/.

To change the port of the development use the --port option.

Further help

To get help for these commands and more, run dojo on the command line.

Server

The server is located under the server directory and uses NestJS to provide APIs to the client.

Starting

The server uses ts-node and does not require a build to start. Use npm run start to start the server.

Acknowledgements