Giter Site home page Giter Site logo

dangolbeeker / ru102js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redislabs-training/ru102js

0.0 1.0 0.0 1.53 MB

Source code for the RU102JS Redis for JavaScript Developers Course

Home Page: https://university.redis.com/courses/ru102js/

License: MIT License

HTML 1.25% JavaScript 98.50% Lua 0.25%

ru102js's Introduction

RediSolar for Node.js

Introduction

This is the sample application codebase for RU102JS, Redis for JavaScript Developers at Redis University.

Solutions to the course programming challenges can be found on the solutions branch.

Prerequisites

In order to start and run this application, you will need:

  • Node.js (8.9.4 or newer, we recommend using the current Long Term Stable version)
  • npm (installed with Node.js)
  • Access to a local or remote installation of Redis version 5 or newer (local preferred)
  • If you want to try the RedisTimeSeries exercises, you'll need to make sure that your Redis installation also has the RedisTimeSeries Module installed

If you're using Windows, check out the following resources for help with running Redis:

Setup

To get started:

$ npm install

Configuration

The application uses a configuration file, config.json to specify the port that it listens on plus some logging parameters and how it connects to a database.

The supplied config.json file is already set up to use Redis on localhost port 6379. Change these values if your Redis instance is on another host or port, or requires a password to connect.

{
  "application": {
    "port": 8081,
    "logLevel": "debug",
    "dataStore": "redis"
  },
  "dataStores": {
    "redis": {
      "host": "localhost",
      "port": 6379,
      "password": null,
      "keyPrefix": "ru102js"
    }
  }
}

The keyPrefix for Redis is used to namespace all the keys that the application generates or references. So for example a key sites:999 would be ru102js:sites:999 when written to Redis.

Load Sample Data

To load sample site data and sample metrics, run:

npm run load src/resources/data/sites.json flushdb

flushdb is optional, and will erase ALL data from Redis before inserting the sample data.

The application uses the key prefix ru102js by default, so you should be able to use the same Redis instance for this application and other data if necessary.

Development Workflow

In order to speed up development, you can run the application using nodemon, so that any changes to source code files cause the server to reload and start using your changes.

npm run dev

Edit code, application will hot reload on save.

If you want to run without nodemon, use:

npm start

But you will then need to stop the server and restart it when you change code.

Accessing the Front End Web Application

You should be able to see the front end solar dashboard app at:

http://localhost:8081/

Running Tests

The project is setup to use Jest for testing. To run all tests:

npm test

To run a specific suite of tests (e.g. those in tests/basic.test.js):

npm test -t basic

To run Jest continuously in watch mode, which gives you access to menus allowing you to run subsets of tests and many more options:

npm testdev

Linting

This project uses ESLint with a slightly modified version of the Airbnb JavaScript Style Guide.

  • The file .eslintrc contains a short list of rules that have been disabled for this project.
  • The file .eslintignore contains details of paths that the linter will not consider when linting the project.

To run the linter:

npm run lint

Subscribe to our YouTube Channel

We'd love for you to check out our YouTube channel, and subscribe if you want to see more Redis videos!

ru102js's People

Contributors

itsrojasleon avatar

Watchers

James Cloos 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.