Giter Site home page Giter Site logo

basemax / randomrealnameapigo Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 788 KB

A Go web-service API for generating random user names (gender-aware), An online and secure web service to create unique random usernames lists.

License: GNU General Public License v3.0

Python 7.20% Go 92.80%
api go golang web-service webservice

randomrealnameapigo's Introduction

Random Real Name API Go

A Go web-service API for generating random user names (gender-aware), An online and secure web service to create unique random usernames lists.

Assignment

In most projects, we need to generate random names, but we do not want to use random characters. We need real names.

We have an email provider which provides your email address. By getting this repository they will be able to generate many random email address but meanfull names.

The challenge of this is to generate a meaningful but UNIQUE name!

Suppose you are going to generate 10k email address, so you need to have a lot of unique names. An email address is a mix of name, family, age, or maybe a date. So by using different value we are going to generate unique name.

Communication way

We are going to use JSON standard format and so our API / web service will be RESTful.

Technology

Go

The main part

When a request asks us to generate 1000 UNIQUE names. we need to make sure we are going to generate UNIQUE names.

In the process, Maybe we generate 2000 names and after filtering the final result was 1000 UNIQUE names. So when we find a limit number of unique names. it ends and we send the output to that request.

Routes

  • GET /

A route that will show this document and everyone can study more about the project as well as this README.markdown.

  • GET /get

Parameters:

  • The default value of limit is 1 but you are able to change limit to any number of emails you need. like 100.

  • The default value of gender is "both", But if you want to get random names for Male or Female you need to set it to male or female.

This route not going to generate an email for you. this only generates random and UNIQUE names.

Output:

{
   "status": 1,
   "name": "alireza2000"
}

Or maybe as following if you are asking for more than one name:

{
   "status": 1,
   "names": [
    "alireza2004",
    "hamid.h3000",
    "max.base1"
   ]
}

Or if something went wrong:

{
   "status": 0,
   "message": "Oops, sorry. Something does not go as we expected."
}

Note: Obviously, the HTTP Code is expected to be 200 if the request is answered successfully. Otherwise, you can use the appropriate code according to the error.

What do you need to search for?

We need a long list of first names and last names. There are several public databases about names.

It can be two different files too. One for first name and the second for family name.

Database or not?

As it is clear, maybe there is no reason to use database in this project. But you can use the database you like.

You can also use the file to store names and surnames. But keep in mind that your web service must be able to respond to a large number of simultaneous requests.

Why Assignment?

Note, I have never applied for a job anywhere until now and this assignment project is designed by myself. Right now I'm enjoying GitHub and I'm not looking for solving assignments for others. Best Wishes.

Authors

  • Ahmad Amoori
  • Max Base

Anyone is welcome to contribute, change or develop this project. Thanks in advance, Any comments are appreciated.

randomrealnameapigo's People

Contributors

itsjoniur avatar amir-shiati avatar

Stargazers

Alexandre Lamberty avatar

Watchers

 avatar

randomrealnameapigo's Issues

Fixing bug of name generator

	for i := 0; i < limit; i++ {
		newName := GenerateName(nameList)
		if slices.Contains(result, newName) {
			continue
		}
		result = append(result, newName)
	}

In my opinion, the following line is not optimum and we have to change it.

	for i := 0; i < limit; i++ {

Generally, it's better to use a while loop and continue until we have limit number of elements inside result .

So in this case, we do not need i variable.

What is \r inside names?

JSON

// 20220822063306
// http://localhost:8000/get?limit=5

{
  "names": [
    "rickie\rscheffer\r",
    "rasheeda\r.scavo\r",
    "sandra\rpalifka\r888",
    "gregory\rgushi\r274",
    "caroyln\rvanfleet\r230"
  ],
  "status": 1
}

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.