Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

# GMAppsApi
( Gio M Apps Api)
# gmdevapi

## Welcome to my backend!
This is a backend for my applications written in Node/ExpressJS for Google Cloud Functions!
## Backend for gmdevapi & gmdevstore
This repo hosts the code that is used by my personal portfolio and API sites.

### This repository contains:

1. Google Cloud Functions
2. Express JS
1. Cloudflare workers
2. JS
3. Fetching API's with Async/Await functionality

---
Expand All @@ -29,8 +28,8 @@ This is a backend for my applications written in Node/ExpressJS for Google Cloud

## Goals:

1. Understand Cloud Functions and the GCP
2. Understand Node / Express JS
1. Understand Cloud Functions and workers
2. Understand JS
3. Keep my Secrets secure for external API usage
4. Create a backend for all my personal applications
5. Gain a deeper understanding of full stack development
Expand All @@ -40,11 +39,6 @@ This is a backend for my applications written in Node/ExpressJS for Google Cloud
npm install
npm start

Special command for gcloud:

gcloud functions deploy (projectname) --entry-point giotest --runtime nodejs16 --trigger-http --project (cloudname) --memory 128MB --timeout 60s --max-instances 5000


# endpoints
- Spotify:
- User can request different artist information from Spotify from my website
Expand Down Expand Up @@ -84,10 +78,7 @@ Special command for gcloud:
> /v1/GOV/debt

# RelatedProjects
> https://giomoscato.com/#/

> https://fullstackingdevelopment.com/

> https://gmdevstore.com/#/

# webresources
>http://expressjs.com/
Expand All @@ -105,24 +96,19 @@ Special command for gcloud:
>https://console.cloud.google.com/functions

# credits
From > https://sketchfab.com
> Provence House 3D scan ZenFone AR by mano1creative, under CC.

# extra
# packages
>"dependencies": {"@google-cloud/functions": "^2.2.0","@google-cloud/functions-framework": "^3.1.2","cross-fetch": "^3.1.5","dotenv": "^16.0.1","express": "^4.18.1","node-fetch": "^3.2.9"}
---

# Maintainers
**Giovanni Moscato**
[Yupimaperson101@protonmail.com](Yupimaperson101@protonmail.com)

### Contributing
**NA**


## Contributors
**Giovanni J Moscato**

---

Expand All @@ -136,9 +122,3 @@ If your README is compliant with Standard-Readme and you're on GitHub, it would
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

## RecentUpdates

Created 4 new endpoints
**Date: 8/2/2022**

Created ENV secrets
**Date: 7/26/2022**
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"name": "gmapps-api-v1",
"version": "1.0.0",
"description": "A template for kick starting a Cloudflare Workers project",
"description": "API to serve content securely to gmdevstore.com",
"main": "./src/index.js",
"scripts": {
"build": "webpack",
Expand All @@ -12,7 +12,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --write '**/*.{js,css,json,md}'"
},
"author": "Giovanni Moscato <69764323+codingcodewhilegoofin@users.noreply.github.com>",
"author": "_gmdev",
"license": "MIT",
"devDependencies": {
"html-loader": "^4.2.0",
Expand Down
1 change: 0 additions & 1 deletion src/handlers/Financial/cryptoTicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const CryptoTicker = async (request, event) => {
adjusted = 'true';
}


try {
const response = await fetch( ( polygonUrlBaseCrypto + `${cryptoTicker}/` + `prev?adjusted=${adjusted}`+ `&apiKey=${POLYGON_API_KEY}` ) );

Expand Down
1 change: 0 additions & 1 deletion src/handlers/Financial/gov.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const GovData = async (request, event) => {

try {
Expand Down
1 change: 0 additions & 1 deletion src/handlers/Financial/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const NftTicker = async (request, event) => {
collectionName = 'cryptopunks';
}


try {
const nftOptions = {method: 'GET'};

Expand Down
2 changes: 0 additions & 2 deletions src/handlers/Mongo/MongoCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ let social = ['1', '2'];
let plug = '';
let date = '2022-12-08T01:11:18.965Z';


const MongoCreate = async (request, event) => {

if (request.params.name) {
Expand All @@ -32,7 +31,6 @@ const MongoCreate = async (request, event) => {
date = '2022-12-08T01:11:18.965Z';
}


try {

async function createDocument() {
Expand Down
1 change: 0 additions & 1 deletion src/handlers/Mongo/MongoDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const MongoDelete = async (request, event) => {
body: JSON.stringify(data),
};


const MongoResponse = await fetch(MongoUrl, options);

if (!MongoResponse.ok) {
Expand Down
2 changes: 0 additions & 2 deletions src/handlers/Mongo/MongoUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const MongoUpdate = async (request, event) => {
date = '2022-12-08T01:11:18.965Z';
}


try {

async function updateDocument() {
Expand Down Expand Up @@ -72,7 +71,6 @@ const MongoUpdate = async (request, event) => {
body: JSON.stringify(data),
};


const MongoResponse = await fetch(MongoUrl, options);

if (!MongoResponse.ok) {
Expand Down
19 changes: 0 additions & 19 deletions src/handlers/OpenAi/apitest.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
/* import { Configuration, OpenAIApi } from "openai";

const configuration = new Configuration({
apiKey: OPENAI_API_KEY,
}); */
//const openai = new OpenAIApi(configuration);

//Open AI
let userPrompt = 'Chicken Nuggets';

const ApiTest = async (request, event) => {

//const userPrompt = request.params.userPrompt;

try {

/* if (request.params.userPrompt) {
userPrompt = request.params.userPrompt;
} */




const completion = await openai.createCompletion({
model: "text-davinci-002",
prompt: userPrompt,
Expand All @@ -41,7 +23,6 @@ const ApiTest = async (request, event) => {
'Access-Control-Max-Age': '86400',
}
});

}
catch (error) {
console.error("Failed GET for openai data: " + error);
Expand Down
1 change: 0 additions & 1 deletion src/handlers/Spotify/artist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const baseUrl = 'https://accounts.spotify.com/api/token';
const artistUrlBase = 'https://api.spotify.com/v1/artists/';
let artistID = '7bSpQNOg9UsW530DuXM3X5';


const Artist = async (request, event) => {

//const artistID = request.params.artistID;
Expand Down
1 change: 0 additions & 1 deletion src/handlers/Spotify/artists.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ let artistID = '7bSpQNOg9UsW530DuXM3X5';

const Artists = async (request, event) => {


try {

const response = await fetch(baseUrl, {
Expand Down
2 changes: 0 additions & 2 deletions src/handlers/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ const Test = async (request, event) => {
}
});
}

}
catch (error) {
console.error("Failed GET for stock data: " + error);
//res.status(401).send("Could not find ticker symbol or other issue");
}

};

export default Test;
1 change: 0 additions & 1 deletion src/handlers/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const Tests = async () => {
console.error("Failed GET for stock data: " + error);
//res.status(401).send("Could not find ticker symbol or other issue");
}

};

export default Tests;
4 changes: 2 additions & 2 deletions src/html/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<div
style=" padding:5px; width: 100%; height: 100%; background-color: #242a36; display: flexbox; flex-direction: column; border: 2px solid #19819Fff; text-align: center;">

<h1 style="color:#AEBEBEff"> GMA api 🔥</h1>
<h1 style="color:#AEBEBEff"> gmdevapi 🔥</h1>

<h4 style="padding-top: 5px;color:#AEBEBEff; border-top: 1px solid white;"> 404 not found </h4>


<h1 style="color:#AEBEBEff"> 💔</h1>

<a href="/">HOME</a>
<a href="/api/">HOME</a>

</div>
</div>
Expand Down
54 changes: 8 additions & 46 deletions src/html/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404</title>
<title>About</title>
</head>

<body>
Expand All @@ -17,12 +17,12 @@
style=" width: 100%; height: 100%; background-color: black; display: flex; align-self: center; align-items: center; flex-wrap: wrap; flex-direction: row; text-align: center;">


<li style="flex-grow: 1; border: 3px solid 19819Fff;"><a href="/About"
<li style="flex-grow: 1; border: 3px solid 19819Fff;"><a href="/api/About"
style="color: #025B79ff; font-weight:200; font-size:x-large; cursor: pointer; ">About</a></li>
<li style="flex-grow: 1; border: 3px solid 19819Fff; "><a href="/Endpoints"
<li style="flex-grow: 1; border: 3px solid 19819Fff; "><a href="/api/Endpoints"
style="color: #025B79ff; font-weight:200; font-size:x-large; cursor: pointer; ">Endpoints</a>
</li>
<li style="flex-grow: 1; border: 1px solid 19819Fff; "><a href="/Contact"
<li style="flex-grow: 1; border: 1px solid 19819Fff; "><a href="/api/Contact"
style="color: #025B79ff; font-weight:200; font-size:x-large; cursor: pointer; ">Contact</a>
</li>

Expand All @@ -31,12 +31,12 @@
<h1 style="color:#AEBEBEff"> GMA api 🔥</h1>
<h1 style="color:#AEBEBEff ; border-top: 1px solid white"> About</h1>

<p style="color:#AEBEBEff"> The GMAapi ( Gio M apps API ) was build with the purpose of
<p style="color:#AEBEBEff"> The gmdevapi was build with the purpose of
security, re-usability, and ease in mind. It is part of our project ecosystem and
was originally developed for FSD / GMA applications. We made the API available
was originally developed for my applications. We made the API available
publically as a proof of concept and ease of use. Anyone can call the
GMA API via HTTP requests to cloudflare. We have implemented WAF, rate-limiting,
standard practices, and other security measures to protect our own application
api via HTTP requests to cloudflare. We have implemented standard
security measures to protect our own application
as well as 3rd party API's. This is what enables our API to be public
facing without Authorization. The API has various endpoints for features
of our current applications. We plan on adding more routes later.
Expand All @@ -48,48 +48,10 @@ <h1 style="color:#AEBEBEff ; border-top: 1px solid white"> About</h1>
</p>

<h3 style="color:#AEBEBEff"> Built with Cloudflare workers </h3>
<a href="gmapps-api-v1.giomoscato.workers.dev">gmapps-api-v1.giomoscato.workers.dev/</a>
<h3 style="color:#AEBEBEff; padding-bottom: 5px;"> Source Code maintained on Gitub </h3>
<a
href="https://github.com/codingcodewhilegoofin/GMA-api-cloudflare">https://github.com/codingcodewhilegoofin/GMA-api-cloudflare</a>

<h4 style="padding-top: 5px;color:#AEBEBEff; border-top: 1px solid white;"> API used by </h4>

<div
style=" padding-bottom: 5px; width: 100%; height: 100%; background-color: #242a36; display: flexbox; flex-direction: row; text-align: center;">


<a href="https://giomoscato.com/"
style=" padding-left:5px; padding-right: 20px;border-left: 2px solid #787170ff; flex-grow: 1; border: 3px solid 19819Fff; color: #AEBEBEff">
giomoscato.com</a>

<a href="https://fullstackingdevelopment.com/"
style=" padding-left:5px; border-left: 2px solid #EE0527ff; flex-grow: 1; border: 3px solid 19819Fff; color: #AEBEBEff">
fullstackingdevelopment.com</a>


</div>

<h4 style="padding-top: 5px;color:#AEBEBEff; border-top: 1px solid white;"> Site preview </h4>

<div
style=" padding-bottom: 5px; width: 100%; height: 100%; background-color: #242a36; display: flexbox; flex-direction: row; text-align: center;">


<a
style=" padding-bottom:5px; padding-left:5px; padding-right: 20px;border-left: 2px solid #787170ff; flex-grow: 1; border: 3px solid 19819Fff; color: #AEBEBEff">
giomoscato.com</a>

<iframe src="https://giomoscato.com/#/" padding="auto" width='100%' height="500"
allowtransparency="true" frameborder="0"
sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>


<a href="/">HOME</a>


</div>
</div>
</body>

</html>
Loading