Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
firebase functions test

express dep

test

m
  • Loading branch information
TehZarathustra committed May 3, 2018
1 parent c5ebab1 commit 6e4ff63
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ npm run start
{
name: String, // actual player name
asset: String, // actual flown asset
},
},
...
],
bluePlayers: Array // same as above
Expand Down
40 changes: 40 additions & 0 deletions app/components/duel/duel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="duel">
<h1>Duel</h1>
<v-btn @click="sendKek()" block>kek</v-btn>
</div>
</template>

<script>
import Firebase from 'firebase';
import Axios from 'axios';
export default {
firebase () {
return {
assets: {
source: Firebase.database().ref('assets'),
readyCallback: function () {
this.loaded = true;
}
}
}
},
data () {
return {
loaded: false
}
},
methods: {
sendKek() {
Axios.get('/testkek')
.then(function (response) {
console.log('response >>>', response);
})
.catch(function (error) {
console.log('error >>>', error);
});
}
}
}
</script>
4 changes: 3 additions & 1 deletion app/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import VueRouter from 'vue-router';
import Home from '../components/home/home.vue';
import Mission from '../components/mission/mission.vue';
import Results from '../components/results/results.vue';
import Duel from '../components/duel/duel.vue';

const routes = [
{path: '/', component: Home},
{path: '/campaigns/:campaign/:mission', component: Mission},
{path: '/results', component: Results}
{path: '/results', component: Results},
{path: '/duel', component: Duel}
];

Vue.use(VueRouter);
Expand Down
388 changes: 388 additions & 0 deletions firebase-debug.log

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"**/node_modules/**"
],
"rewrites": [
{
"source": "/testkek",
"function": "app"
},
{
"source": "**",
"destination": "/index.html"
Expand Down
Empty file added functions/config/default.json5
Empty file.
38 changes: 38 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const functions = require('firebase-functions');
const express = require('express');
const config = require('config');

const app = express();
// const TOKEN = config.token;
// const bot = new TelegramBot(TOKEN, {polling: true});

//
const Telegraf = require('telegraf')

const bot = new Telegraf('')

// console.log('keeek >', process.env.BOT_TOKEN);

bot.start((ctx) => ctx.reply('Welcome!'))
bot.help((ctx) => ctx.reply('Send me a sticker'))
bot.on('sticker', (ctx) => ctx.reply('👍'))
bot.hears('hi', (ctx) => ctx.reply('Hey there'))
bot.hears(/buy/i, (ctx) => ctx.reply('Buy-buy'))

bot.startPolling();
//

app.get('/testkek', function (request, response) {
console.log('config >>', config.token);
console.log('in keks >>>');
response.send('kek is working!');
});

// bot.on('message', (msg) => {
// const chatId = msg.chat.id;
// console.log('on???');

// bot.sendMessage(chatId, 'Received your message');
// });

exports.app = functions.https.onRequest(app);
20 changes: 20 additions & 0 deletions functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"@google-cloud/functions-emulator": "^1.0.0-beta.4",
"config": "^1.30.0",
"express": "^4.16.3",
"firebase-admin": "~5.8.1",
"firebase-functions": "^0.8.1",
"node-telegram-bot-api": "^0.30.0"
},
"private": true
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
"webpack-dev-server": "^2.5.0"
},
"dependencies": {
"axios": "^0.18.0",
"firebase": "^4.2.0",
"font-awesome": "^4.7.0",
"lodash": "^4.17.4",
"normalize.css": "^7.0.0",
"moment": "^2.19.2",
"firebase": "^4.2.0",
"normalize.css": "^7.0.0",
"vue": "^2.4.1",
"vue-template-compiler": "^2.4.1",
"vue-router": "^2.7.0",
"vue-template-compiler": "^2.4.1",
"vuefire": "^1.4.3",
"vuetify": "^0.17.6",
"font-awesome": "^4.7.0",
"vuex": "^3.0.1"
}
}

0 comments on commit 6e4ff63

Please sign in to comment.