-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Couldn't add simple unit test, added ci
- Loading branch information
Showing
47 changed files
with
921 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# credits: | ||
# - CI with Jest: https://joelhooks.com/jest-and-github-actions | ||
name: CI | ||
on: pull_request | ||
jobs: | ||
test: | ||
name: Test | ||
# setup global configurations | ||
strategy: | ||
matrix: | ||
node-version: [12.x] | ||
platform: [ubuntu-latest, windows-latest, macos-latest] | ||
# Build OS | ||
runs-on: ${{ matrix.platform }} | ||
# CI | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# select nodejs v12 | ||
- name: Test using Node.js v${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
# install packages | ||
- name: Install Packages | ||
run: npm i | ||
# create a config file | ||
# - name: Create Config File | ||
# uses: "DamianReeves/write-file-action@v1.0" | ||
# with: | ||
# path: ./config.json | ||
# contents: '{"BITLY_TOKEN": "${{ secrets.BITLY_TOKEN }}","TWITCH_TOKEN": "${{ secrets.TWITCH_TOKEN }}","DISCORD_TOKEN": "${{ secrets.DISCORD_TOKEN }}"}' | ||
# write-mode: overwrite | ||
# # run tests | ||
# - name: Run tests | ||
# run: npm run test:ci | ||
# # conditions with test fails or succeeds | ||
# - name: Tests ✅ | ||
# shell: bash | ||
# if: ${{ success() }} | ||
# run: | | ||
# curl \ | ||
# -X POST \ | ||
# -H 'Accept: application/vnd.github.v3+json' \ | ||
# -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
# -d '{ | ||
# "context": "tests", | ||
# "state": "success", | ||
# "description": "Tests passed", | ||
# "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# }' \ | ||
# https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} | ||
# - name: Tests 🚨 | ||
# if: ${{ failure() }} | ||
# shell: bash | ||
# run: | | ||
# curl \ | ||
# -X POST \ | ||
# -H 'Accept: application/vnd.github.v3+json' \ | ||
# -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
# -d '{ | ||
# "context": "tests", | ||
# "state": "failure", | ||
# "description": "Tests failed", | ||
# "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# }' \ | ||
# https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} | ||
# Code Coverage | ||
# - name: Code Coverage | ||
# uses: codecov/codecov-action@v1 | ||
# with: | ||
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
# remove the config file | ||
# - name: Remove Config File | ||
# uses: JesseTG/rm@v1.0.2 | ||
# with: | ||
# path: "config.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,43 @@ | ||
const express = require('express'), | ||
mongoose = require('mongoose'), | ||
ejs = require('ejs'); | ||
const express = require("express"), | ||
mongoose = require("mongoose"), | ||
ejs = require("ejs"); | ||
|
||
const router = require("./routes/index"), | ||
streamer_router = require("./routes/streamer"), | ||
rank_router = require("./routes/rank"), | ||
validate_router = require("./routes/validate"), | ||
ai_router = require("./routes/ai"); | ||
|
||
require('dotenv').config({path:'../../.env'}); | ||
require("dotenv").config({ path: "../../.env" }); | ||
|
||
const app = express(), | ||
port = process.env.PORT || 4000; | ||
|
||
app.use(express.json()) | ||
app.use(express.static(__dirname + '/public')); //Serves resources from public folder | ||
app.set('view engine', 'ejs'); | ||
app.use(express.json()); | ||
app.use(express.static(__dirname + "/public")); //Serves resources from public folder | ||
app.set("view engine", "ejs"); | ||
|
||
main().catch(err => console.log(err)); | ||
main().catch((err) => console.log(err)); | ||
|
||
async function main() { | ||
await mongoose.connect(process.env.DATABASE_URL, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
tlsCAFile: "../../ca-certificate.crt" | ||
}).catch(err => { | ||
console.error(err.stack) | ||
process.exit(1) | ||
}); | ||
await mongoose | ||
.connect(process.env.DATABASE_URL, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
tlsCAFile: "../../ca-certificate.crt", | ||
}) | ||
.catch((err) => { | ||
console.error(err.stack); | ||
process.exit(1); | ||
}); | ||
} | ||
|
||
app.use('/streamer', streamer_router) | ||
app.use('/rank', rank_router) | ||
app.use('/validate', validate_router) | ||
app.use('/ai', ai_router) | ||
app.use('/', router) | ||
|
||
app.use("/streamer", streamer_router); | ||
app.use("/rank", rank_router); | ||
app.use("/validate", validate_router); | ||
app.use("/ai", ai_router); | ||
app.use("/", router); | ||
|
||
app.listen(port, () => { | ||
console.log(`localhost:${port}`) | ||
}); | ||
console.log(`localhost:${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.