This file contains hidden or 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
| const Fastify = require('fastify'); | |
| const requestmaker = require('./requestMaker'); | |
| // SERVER | |
| const app = Fastify({ logger: true, pluginTimeout: 100000, trustProxy: true }); | |
| // Declare a route | |
| app.get('/fetch', async (request, response) => { | |
| let result; | |
| try { | |
| result = await requestmaker({ |
This file contains hidden or 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
| import { Suspense, useState, useEffect } from "react"; | |
| const SuspensefulUserProfile = ({ userId }) => { | |
| const [data, setData] = useState({}); | |
| useEffect(() => { | |
| fetchUserProfile(userId).then((profile) => setData(profile)); | |
| }, [userId, setData]); | |
| return ( |
This file contains hidden or 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
| import * as fastify from 'fastify'; | |
| import tooling from '../libraries/tracer/tooling'; | |
| import ImageUploadRoute from './v1/imgeUpload'; | |
| export default (app: fastify.FastifyInstance) => { | |
| app.addHook("preHandler", tooling); | |
| app.register(ImageUploadRoute, { prefix: '/api/v1/upload' }); | |
| } |
This file contains hidden or 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
| import * as fastify from 'fastify'; | |
| import {db} from '../db/sequelize'; | |
| import validator from '../utils/requestValidator'; | |
| import Responses from '../utils/responses'; | |
| import path from 'path'; | |
| import minioClient from '../utils/minioClient'; | |
| import { ServerResponse } from "http"; | |
| import { v4 as uuidv4 } from 'uuid'; | |
| import minioBucket from '../utils/makeBucket'; | |
| const configs = (require('../../config/url.json')[process.env.NODE_ENV]); |
This file contains hidden or 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
| import * as fastify from 'fastify'; | |
| import Responses from '../../utils/responses'; | |
| // require('../../models/user.model')(); | |
| import {RouteSchema} from '../../@types/routeschema'; | |
| import ImageUploadController from '../../controllers/imageUpload.controller'; | |
| import Requests from '../../utils/requests'; | |
| export default (app: fastify.FastifyInstance, options, done) => { |
This file contains hidden or 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
| import minioClient from '../utils/minioClient'; | |
| const minioBucket = (folder_name) => { | |
| minioClient.makeBucket(folder_name, 'us-east-1', function(err) { | |
| if (err) return console.log(err.code) | |
| console.log('Bucket created successfully in "us-east-1".') | |
| var metaData = { | |
| 'Content-Type': 'application/octet-stream', |
This file contains hidden or 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
| const Minio = require('minio'); | |
| const minioClient = new Minio.Client({ | |
| endPoint: '127.0.0.1', | |
| port: 9000, | |
| useSSL: false, | |
| accessKey: 'AKIAIOSFODNN7EXAMPLE', | |
| secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' | |
| }); |
This file contains hidden or 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
| import fastify from 'fastify'; | |
| import reqmaker from '../../utils/requestmaker'; | |
| import Responses from '../../utils/responses'; | |
| export default async function(request: fastify.FastifyRequest, response, next) { | |
| const token = request.headers["authorization"] || ""; | |
| console.log(request.headers); | |
| let validate; | |
| try { |
This file contains hidden or 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
| FROM node:12-alpine as builder | |
| RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app | |
| WORKDIR /home/node/app | |
| COPY package*.json ./ | |
| RUN npm config set unsafe-perm true | |
| RUN npm install -g typescript | |
| RUN npm install -g ts-node | |
| USER node | |
| RUN npm install | |
| COPY --chown=node:node . . |
This file contains hidden or 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
| version: '3.7' | |
| services: | |
| app: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile-build | |
| image: gateway | |
| container_name: gateway | |
| restart: unless-stopped |
NewerOlder