Code Monkey home page Code Monkey logo

pointboard's Introduction

Point Board

Development

Install dependencies

Backend dependencies

Run go install from backend/

Frontend dependencies

From the project root directory:

cd frontend
npm install

Generate html template

Within the frontend/ folder, run

npm run build

This will create or update index.html and bundle/bundle.js inside dist (The dist folder will be created if it doesn't exist). For more information on npm run build, take a look at package.json and webpack.

The backend will use frontend/dist/index.html as a html template, which it populates using data from the database and serves to the browser.

Develop frontend

Within the frontend/ folder, run

npm start

This will starts the frontend in development mode and begin listening on port (8080 by default). Visit localhost:8080 if it is not opened in browser yet. :x

Note that this is limited in the sense that the frontend doesn't pull data from the database. Only the backend is able to pull data, populate the template, and serves to the browser. Therefore, the page you will see on localhost:8080 isn't populated with data. However, this is a convenient way to see the effect of stylesheets, and some frontend scripts.

Start the database

To run a local database, make sure you have redis installed. Start the server by running redis-server. This will start the database on port 6379 by default.

Development database vs. testing database

You need to run two different database for development and testing. Specify the database url for each database in backend/config.go.

Develop Backend

From the backend/ folder, run

go run server.go

to start the server. Make sure that the database config is correct in the config.go file.

Testing backend

From the backend/ folder, run go test to start the tests.

Deployment

  1. Make sure you have run npm run build to reflect your latest edit on frontend
  2. Use Copilot to deploy!

Deploy Database

Under project root directory, run:

touch db.Dockerfile
echo "FROM redis\nEXPOSE 6379" >> db.Dockerfile

This will expose the port 6379 for incoming traffic. You can use a different port but make sure to change the deployment configuration in backend/config.go accordingly.

While using Copilot:

  1. Use db.Dockerfile to deploy the database
  2. Be sure to select "Backend App" for app type. For more information, visit here. You can use environment variables to set up the dbURL in backend/config.go, as described here.

Deploy Backend

Similarly, deploy the backend using Copilot, and select "Load Balanced Web App" for app type. For more information, visit here.

pointboard's People

Contributors

louise15926 avatar lou1415926 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.