Giter Site home page Giter Site logo

persinammon / poke-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.61 MB

Node.js based web application consuming Pokemon API (unfinished, but introduced to React, Docker, Webpack,...)

License: MIT License

HTML 2.21% JavaScript 96.54% SCSS 1.24%
expressjs mongodb nodejs pokeapi pokemon-api reactjs deployment docker-service aws gcp

poke-app's Introduction

Pokémon Social App

This web application allows users to sign up, create teams, and collaboratively create team rosters.

It is unfinished. There was a working app with an Auth0 login, a landing page, and a side menu bar from a React library. I also covered tutorials on how to set up a Node.js web application with a Postgres/MongoDB back-end, as well as how to use Webpack, hot deployment, and React for front-end. I overscoped the initial project, and also decided to focus more on C++ and other projects, so I've left my work as an example of a learning process.

Issue Faced When Deploying 2 Services

Originally, I structured the project as two Docker environments - one for the MongoDB database and one running the Node.js web application. I had figured that for scaling up, I could keep one database instance while having multiple instances of the web application. Unfortunately, I ran into an issue when deploying two services to the cloud (I tried both Amazon EKS and Google Cloud Platform). Both were saved as separate repositories with one image mapping to one repository. I was unable to use Docker-Compose to start up both instances in tandem, despite writing everything to successfully connect the database to the application on my local setup. I looked to Google forums and StackOverflow for previous run-ins with this issue, and was unable to find anything or solve it myself. I tried using [Kompose](https://kompose.io/]() to deploy services to Kubernetes.

So, unfortunately I've had to move the old Dockerfiles and Docker compose YAML to a new folder and start anew. Being proud of my docker-compose file, it was a bit unfortunate.

Dependencies

  • Node.js
  • Express.js
  • React.js
  • MongoDB
  • Socket.io
  • Chakra-UI
  • Webpack to bundle assets
  • PokéAPI
  • Common middleware associated with Express.js (found in server/package.json)
  • Mocha and Chai test frameworks

Running Locally in Docker, if Using 2 Services

Move Dockerfiles to correct codebases, and docker compose file to the top-level folder.

To start the services:

docker compose up -d

To end the services and clean up containers:

docker compose down

Local Development Setup

  1. Install Node.js on computer and clone directory. Check installation:
node --version
  1. Install packages using npm.
cd server
npm i 
cd ../client
npm i 

For development, a cloud MongoDB database was used, requiring developer credentials. PokéAPI has no required credentials or rate limiting.

  1. Run using node or nodemon. nodemon allows for hot deployment, or automatic server restart on code changes. Both are included in the npm scripts defined in package.json.

Deployment:

npm start

Hot deployment:

npm run devstart
  1. Navigate to localhost:3000 to interact with web application UI.

  2. Use curl to test endpoints. Examples:

curl -d @test/testcase.json -H "Content-Type: application/json" http://localhost:8000
curl -v http://localhost:8000
curl -v http://localhost:3000

Run tests in server/test folder.

poke-app's People

Contributors

persinammon avatar

Watchers

 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.