Responsible for provide data to the web front-end. Generates names based on preseted datasets (list of example names), but you can upload a custom dataset (it must have at least 23 names). Was utilized the Markov Chain algorithm to generate the names, a custom script was created based on this article: Generating Startup names with Markov Chains.
Live Demo: https://named-api.onrender.com/
To start up the app run:
$ go run .
Or:
go run main.go
Or even:
$ ./scripts/run.sh
route | HTTP Method | params | description |
---|---|---|---|
/datasets |
GET | - | Retrieve available datasets. |
/names |
GET | dataset query parameter. |
Generate names for the dataset provided. |
/feedbacks |
POST | Body with an array of feedbacks with name and value . |
Save good feedbacks |
/upload |
POST | Body with dataset form data (See insomnia file for good example). | Create a custom dataset. |
POST /feedbacks
Request body:
[
{
"name": "Jordan",
"value": 1
}
]
POST /upload
Request body:
"file"=<file>
To run the projects' tests the app:
$ ./scripts/test.sh
Or:
$ go test ./tests/... -cover -coverpkg=./controllers,./helpers -coverprofile=coverage-report.out
You can see the coverage report on root folder coverage-report.out
. They are automatically created after the tests run (with you used the command above).