Skip to content

conao3/firebase-helper.ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://raw.githubusercontent.com/conao3/files/master/blob/headers/png/firebase-helper.ts.png https://img.shields.io/github/license/conao3/firebase-helper.ts.svg?style=flat-square https://img.shields.io/github/tag/conao3/firebase-helper.ts.svg?style=flat-square https://img.shields.io/travis/conao3/firebase-helper.ts/master.svg?style=flat-square https://img.shields.io/codacy/grade/3be4830366a5413d9654c74653ad2dc5.svg?logo=codacy&style=flat-square https://img.shields.io/badge/patreon-become%20a%20patron-orange.svg?logo=patreon&style=flat-square https://img.shields.io/badge/twitter-@conao__3-blue.svg?logo=twitter&style=flat-square https://img.shields.io/badge/chat-on_slack-blue.svg?logo=slack&style=flat-square

Table of Contents

Description

firebase-helper is project hosting on google firebase.

License Terms

Display license such as license section If you use this project API or code in your project.

Install

You don’t need install. This project is already deployed on google firebase.

Usage

Access each url on browser, or curl it.

hello

https://us-central1-conao3-helper.cloudfunctions.net/hello

curl https://us-central1-conao3-helper.cloudfunctions.net/hello
  Hello from Firebase!

hello_args

https://us-central1-conao3-helper.cloudfunctions.net/hello_args/conao3

curl https://us-central1-conao3-helper.cloudfunctions.net/hello_args/conao3
  Hello from Firebase!conao3

https://us-central1-conao3-helper.cloudfunctions.net/hello_args/:name

  • :name is string

date

https://us-central1-conao3-helper.cloudfunctions.net/date

curl https://us-central1-conao3-helper.cloudfunctions.net/date
  2019-02-03T03:15:11+00:00

github_header

https://us-central1-conao3-helper.cloudfunctions.net/github_header/firebase-helper.svg Return header for GitHub.

https://us-central1-conao3-helper.cloudfunctions.net/github_header/firebase-helper.svg

curl http://localhost:9000/conao3-helper/us-central1/github_header/firebase-helper
  <svg xmlns="http://www.w3.org/2000/svg" width="1000" height="170">
  <style xmlns="http://www.w3.org/2000/svg" type="text/css">
  @import url('https://fonts.googleapis.com/css?family=Sarabun:100');
  text {font-size: 70px; font-family: 'Sarabun', sans-serif; font-weight: 100;}
  </style>
  <g>
  <rect x="0" y="0" width="100%" height="100%" fill="#222"></rect>
  </g>
  <g fill="#fff" font-family="Open Sans">
  <text x="90" y="120" font-size="50">firebase-helper</text>
  </g>
  </svg>

https://us-central1-conao3-helper.cloudfunctions.net/github_header/:header.svg

  • :header is string

    If you use ;/?:@&=+$-_!~*.,()#'~ in ~:header, must be URL encoded.

    Fail decodeURIComponent, or not specify argument, return svg with github-header.

  • urlquery
    • ?:background is background color wuthout #
    • ?:forground is forground color withour #

ex: https://us-central1-conao3-helper.cloudfunctions.net/github_header/conao3%2Ffirebase-helper.svg?forground=000&background=abc

shield_docker

NOW UNAVAIRABLE in FREE FIREBASE ACCOUNT

As free firebase account’s function is not allowed accessing other api, this function don’t working.

It works only localhost :)

https://us-central1-conao3-helper.cloudfunctions.net/shield_docker/conao3/po4a/name

curl https://us-central1-conao3-helper.cloudfunctions.net/shield_docker/conao3/po4a/name
  <svg xmlns="http://www.w3.org/2000/svg" width="170" height="20">
  <g>
  <rect x="0" y="0" width="100%" height="100%" fill="#007ec6"></rect>
  <rect x="0" y="0" width="86" height="100%" fill="#555"></rect>
  </g>
  <g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
  <text x="5" y="14">docker unknown</text>
  <text x="128" y="14" text-anchor="middle">unknown</text>
  </g>
  </svg>

https://us-central1-conao3-helper.cloudfunctions.net/shield_docker/:username/:imagename/:badgetype

  • :username and :imagename use of MicroBadger.
  • badgetype is allowed below type
    • name
    • layers
    • size
    • version
    • pulls
    • stars

Information

Donation

I love OSS and I am dreaming of working on it as full-time job.

With your support, I will be able to spend more time at OSS!

https://c5.patreon.com/external/logo/become_a_patron_button.png

Community

All feedback and suggestions are welcome!

You can use github issues, but you can also use Slack if you want a more casual conversation.

Contribution

Feel free to send PR!

Install developer tools

# firebase-tool initialize if you need
npm install -g firebase-tools
firebase login

cd conao3-helper/functions
npm install

Local test

localtest NOTICE

When functions are tested locally, access to the database and saving are done on the production data.

Functions test

cf: https://firebase.google.com/docs/functions/local-emulator

Open other terminal and run it to automate build TS.

cd firebase-helper/functions/
./node_modules/.bin/tsc --watch

Serve functinos on localhost.

firebase serve --only functions --port=9000
  === Serving from '/Users/conao/Develop/git/firebase-helper'...

  i  functions: Preparing to emulate functions.
  Warning: You're using Node.js v11.8.0 but Google Cloud Functions only supports v6.11.5.
  ✔  functions: hello: http://localhost:9000/conao3-helper/us-central1/hello

Access url on prompt.

curl http://localhost:9000/conao3-helper/us-central1/hello
  Hellow from Firebase!

Reference

Deploy

If you want to deploy your firebase, clone, fix and deploy.

Clone

git clone https://github.com/conao3/firebase-helper

cd firebase-helper/

Fix .firebaserc

Fix firebase project name in .firebaserc.

diff --git a/.firebaserc b/.firebaserc
index e1571d9..3c75a00 100644
--- a/.firebaserc
+++ b/.firebaserc
@@ -1,5 +1,5 @@
 {
   "projects": {
-    "default": "conao3-com"
+    "default": "YOUR-FIREBASE-PROJECT"
   }
 }

Deploy

firebase deploy

License

Affero General Public License Version 3 (AGPLv3)
Copyright (c) Naoya Yamashita - https://conao3.com
https://github.com/conao3/firebase-helper.ts/blob/master/LICENSE

Author

Contributors

  • Not yet… Now send PR and add your name!!

About

Conao's helper API working on Google firebase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published