Coder Social home page Coder Social logo

jukebox's Introduction

Open Source Club Jukebox

Description coming soon ...

Technology Stack (with documentation link):

Use Tech
Virtual Environment Docker
Language TypeScript
Backend Runtime Node.js
Backend Framework Express.js
SQL Database Postgres
Unit Tests Mocha

Setup

In order to properly set up this project on your computer you only need Docker Desktop, though it is recommended that you also have Node.js installed.

Download Docker: Docker.com
Docker Tutorial: FreeCodeCamp.org

Download Node.js: Nodejs.org
Node.js Tutorial: PluralSight.com

1. Git Clone

Once they are installed, run the following command in terminal to pull the code from GitHub:

git clone https://github.com/IkeHunter/Jukebox.git

Then navigate to that new folder (make sure you are in the project directory)

cd Jukebox

2. Configure the project

You will need to create the environment variables and any other private variables (secrets) the project uses, you can easily do so with this command which will walk you through the steps:

npm run config

This will create a .env file that contains the necessary environment variables for the server, database, and any other applications that are used. It also creates a new directory called /Playground which is described below.

3. Build Docker

The next command builds the docker containers:

docker build .

4. Run Docker

After the docker containers are built, you simply need to run them with this command to activate the server and database:

docker-compose up

[... describe accessing localhost]

Developing

There are a host of commands built in to this project to make certain tasks easier and more streamlined. Since this project is contained within Docker, running the Node server and Test suite may not be the most intuitive, however. That and more is explained below.

Running the server

The containers defined in docker-compose.yml run automatically with docker-compose, but this will attach the Node server to the API container - essentially making the container unable to run without Node running. To get around this you can either use docker instead of docker-compose, or just restart the docker container when you need to hard restart the server (it restarts automatically with nodemon).

Running Tests

In order to run tests with the docker-compose containers, you first need to access the container shell in a new terminal window with the following command:

Open Container Shell

docker exec -it api sh

After the container shell is opened, you are able to run tests on the active Node server. Node: the server must be running while tests are performing. To run the mocha test suite, use the following command:

Run Unit Tests

npm test

Playground

Sometimes you may want to test a bit of code or a feature without effecting the main project, you can do so inside the /playground directory created during configuration. This directory is hidden from git, so anything added to this folder will be excluded from commits, version control, and GitHub.

This directory contains a simple server.js file that can be run using the following command:

Open Container Shell

npm run playground

Tutorial

Coming soon!

Helpful websites:

setup docker, node, postgres, typescript:
https://dev.to/chandrapantachhetri/docker-postgres-node-typescript-setup-47db
another getting started article: https://www.docker.com/blog/getting-started-with-docker-using-node-jspart-i/
docker best practices with node: https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker/

start with mocha: https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-mocha
Test node api: https://www.digitalocean.com/community/tutorials/test-a-node-restful-api-with-mocha-and-chai

Beginner Resources:
Start node server: https://levelup.gitconnected.com/set-up-and-run-a-simple-node-server-project-38b403a3dc09

environment variables: https://itnext.io/how-to-use-environment-variables-in-node-js-cb2ef0e9574a

jukebox's People

Contributors

ikehunter 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.