Code Monkey home page Code Monkey logo

back2rc4's Introduction

Back2Rc4

Backend for RC4 This contains both database and api for RC4Cal. Uses mysql with node.js. Sequelize is used as ORM to parse queries. Mocha.js is used for testing routes and database queries.


Initialization

Download mysql-server and Run sudo mysql_secure_installation and follow the steps. If you cannot connect to localhost via mysql-workbench or any other client, do:

sudo mysql

When mysql terminal comes up, do:

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

Now, connect to localhost with username admin and password as password

After that, go to terminal and do: ``` yarn test:init ``` Ignore the error this time as this command drops the database (which is nonexistent and hence, error) before creating another one.


Testing

Starting the test environment

To start the testing, open 3 terminal tabs/windows. In terminal 1, do:

yarn tsc:watch

This would allow TypeScript files to compile into JavaScript.

Then, in terminal 2, do: ``` yarn test:start ``` to start the server on localhost.

Watching test environment

To watch for testing, do `yarn test:watch`

Migrations

To migrate test database, do `yarn test:migrate`

How to migrate

To migrate a database, 2 changes are required.

First:
A migration file needs to be created in the migrations folder (command coming soon).

Second:
Models have to be updated.

MOST IMPORTANTLY

Test the migration. As a start, migrate the database, check if tests pass. Rollback the database, check if tests pass. If both conditions are satisfied, migrate the database again. Migration is then successful.

back2rc4's People

Contributors

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