Giter Club home page Giter Club logo

scng-api's Introduction

SCNG API

Deploy

This is a backend api service for SCNG APP.
You can find frontend mobile app here.

Live version of the app is deployed to heroku and is available here. You may have to wait for the app to start, bacause heroku puts the app to sleep after 30min of inactivity.

⚙️ Project setup

  1. Clone repo locally git clone https://github.com/bartolomej/scng-api.git
  2. Install external node modules npm i
  3. Configure environmental variables
  4. Run all tests with jest test
  5. Run application with npm start

⚒️ App configuration

Instead of hard-coding config into some file that is committed to git, it is a good practise to provide app configuration values is via "environmental variables".

That way you achieve a healthy separation of configuration (the inputs that the app receives) and the application itself. Read more about "good practises" here.

An example configuration file can be found under ./env.examples.

📧 How to configure email service

  1. Create a new dummy google account
  2. Disable 2FA auth so that app can login autonomously without your confirmation
  3. Allow access for less secure apps here
  4. Provide google account credentials to environmental variables

🚀 Deploy to Heroku

The easiest way to deploy this app is using Heroku platform:

  1. click deploy to heroku button (located at the top of readme)
  2. set environment variables under settings -> config vars

💜 Some tech used

🔴 Common issues

scng-api's People

Contributors

bartolomej avatar

Watchers

 avatar

scng-api's Issues

Mysql connection deployment issue

remote: App container failed to start!!
=====> scng-api web container output:
       > [email protected] start /app
       > node src/app.js
       { Error: connect ECONNREFUSED 172.17.0.4:3306
           at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)
           --------------------
           at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
           at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
           at PoolConnection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
           at Pool.getConnection (/app/node_modules/mysql/lib/Pool.js:48:16)
           at /app/node_modules/typeorm/driver/mysql/MysqlDriver.js:764:18
           at new Promise (<anonymous>)
           at MysqlDriver.createPool (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:761:16)
           at MysqlDriver.<anonymous> (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:274:51)
           at step (/app/node_modules/tslib/tslib.js:136:27)
           at Object.next (/app/node_modules/tslib/tslib.js:117:57)
         errno: 'ECONNREFUSED',
         code: 'ECONNREFUSED',
         syscall: 'connect',
         address: '172.17.0.4',
         port: 3306,
         fatal: true }
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! [email protected] start: `node src/app.js`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the [email protected] start script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2019-09-01T14_15_42_656Z-debug.log
       > [email protected] start /app
       > node src/app.js
       { Error: connect ECONNREFUSED 172.17.0.4:3306
           at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)
           --------------------
           at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
           at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
           at PoolConnection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
           at Pool.getConnection (/app/node_modules/mysql/lib/Pool.js:48:16)
           at /app/node_modules/typeorm/driver/mysql/MysqlDriver.js:764:18
           at new Promise (<anonymous>)
           at MysqlDriver.createPool (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:761:16)
           at MysqlDriver.<anonymous> (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:274:51)
           at step (/app/node_modules/tslib/tslib.js:136:27)
           at Object.next (/app/node_modules/tslib/tslib.js:117:57)
         errno: 'ECONNREFUSED',
         code: 'ECONNREFUSED',
         syscall: 'connect',
         address: '172.17.0.4',
         port: 3306,
         fatal: true }
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! [email protected] start: `node src/app.js`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the [email protected] start script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2019-09-01T14_15_47_563Z-debug.log
       > [email protected] start /app
       > node src/app.js
       { Error: connect ECONNREFUSED 172.17.0.4:3306
           at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)
           --------------------
           at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
           at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
           at PoolConnection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
           at Pool.getConnection (/app/node_modules/mysql/lib/Pool.js:48:16)
           at /app/node_modules/typeorm/driver/mysql/MysqlDriver.js:764:18
           at new Promise (<anonymous>)
           at MysqlDriver.createPool (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:761:16)
           at MysqlDriver.<anonymous> (/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:274:51)
           at step (/app/node_modules/tslib/tslib.js:136:27)
           at Object.next (/app/node_modules/tslib/tslib.js:117:57)
         errno: 'ECONNREFUSED',
         code: 'ECONNREFUSED',
         syscall: 'connect',
         address: '172.17.0.4',
         port: 3306,
         fatal: true }
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! [email protected] start: `node src/app.js`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the [email protected] start script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2019-09-01T14_15_51_800Z-debug.log
=====> end scng-api web container output
To 167.71.56.97:scng-api
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:scng-api'

Add informative table parsing error message

Current error message:

{"level":"error","message":"Parse timetable for class 384892 failed","description":"Cannot read property '0' of undefined","stack":"TypeError: Cannot read property '0' of undefined\n    at module.exports.saveTimetable (/app/src/parsers/table-serializer.js:10:34)\n    at classes.forEach (/app/src/services/schedule.js:35:15)\n    at process._tickCallback (internal/process/next_tick.js:68:7)","service":"schedule-service"}

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.