Giter Club home page Giter Club logo

go-back's Introduction

Backend for development

It's a backend for frontend development or mobile application development. This program allows you to generate random text for your applications.

How to use it?

You need to download the server and create a .env file or set flags when starting the server.

What should be the file?

ADDRESS=0.0.0.0
PORT=8000
LOGLEVEL=debug
DATABASE_URL="postgresql://ilfey:QWEasd123@localhost:5432/go-back"
DATABASE_FILE=go-back.db
JWT_KEY=secret
JWT_LIFE_SPAN=24

What variables are needed?

  • ADDRESS - The IP address that the server will listen on. Default: 0.0.0.0
  • PORT - The port that the server will listen on. Dafault: 8000
  • LOGLEVEL - Server logging level. Default: info
  • DATABASE_URL - The URL of the PostgeSQL database where users will be stored. Default: postgresql://ilfey:QWEasd123@localhost:5432/go-back
  • DATABASE_FILE - The SQLite database file. Used when it is not possible to connect to the PostgreSQL database. Default: go-back.db
  • JWT_KEY - Secret key to generate JWT. Default: secret
  • JWT_LIFE_SPAN - JWT life span in hours. Default: 24

What flags to set?

You can also start the server with the -h flag to see what flags exist. Flags will take precedence if you use flags and environment file at the same time.

  • -a - The IP address that the server will listen on. Default: 0.0.0.0
  • -p - The port that the server will listen on. Dafault: 8000
  • -ll - Server logging level. Default: info
  • -du - The URL of the PostgeSQL database where users will be stored. Default: postgresql://ilfey:QWEasd123@localhost:5432/go-back
  • -df - The SQLite database file. Used when it is not possible to connect to the PostgreSQL database. Default: go-back.db
  • -jk - Secret key to generate JWT. Default: secret
  • -jls - JWT life span in hours. Default: 24

Routes

Route Description
/ping Check authorization
/text/word?amount={count} Returns the amount of random words
/text/paragraph?amount={count} Returns the amount of random paragraphs
/text/sentence?amount={count} Returns the amount of random sentences
/img/{width}x{height}.png Returns a png image
/img/{width}x{height}.jpg Returns a jpg image
/img/{width}x{height}.gif Returns a gif image
/jwt/register Creates a new user in database
/jwt/login Authorizes the user
/private/text/word?amount={count} Returns the amount of random words
/private/text/paragraph?amount={count} Returns the amount of random paragraphs
/private/text/sentence?amount={count} Returns the amount of random sentences
/private/img/{width}x{height}.png Returns a png image
/private/img/{width}x{height}.jpg Returns a jpg image
/private/img/{width}x{height}.gif Returns a gif image

Text endpoints

http://127.0.0.1:8000/text/word?amount=10

word

http://127.0.0.1:8000/text/sentence?amount=2

sentence

http://127.0.0.1:8000/text/paragraph?amount=1

paragraph

Image endpoints

Query params

  • bg - background color
  • fg - foreground color
  • border - border and diagonal width

When setting fg or bg options you can use alpha channel: 1234 or 12345678

http://127.0.0.1:8000/img/256x256.png?bg=121D32&fg=BF3284

256x256 image

JWT endpoints

http://127.0.0.1:8000/jwt/register

register request

http://127.0.0.1:8000/jwt/login

login request

Ping endpoint

http://localhost:8000/ping

ping

go-back's People

Contributors

2lfey avatar ilfey avatar

Stargazers

 avatar

Watchers

 avatar

go-back's Issues

idea: online demo

Some users want to see how it works without running unknown code. It will also allow them to contact the remote server now and not download your server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.