You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-23Lines changed: 69 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,73 @@
1
1
# API_Names
2
2
3
-
API developed to search for a name by it's metaphone (br) on database and returns all similar names that it can found based on metaphone code and the levenshtein algorithm (0.8 of similarity).
3
+
The API_Names project is designed to find a name and its possible variations from a given name, and correct any misspellings. It uses the Metaphone (br) algorithm to search the database and the Levenshtein distance method for correction.
4
4
5
-
## Setup
6
-
- create a MySql database, you can use [this script](https://github.com/Darklabel91/API_Names/blob/main/database/create_database.txt) if needed
7
-
- set a .env file on the project with ```DB_USERNAME```, ```DB_PASSWORD```, ```DB_NAME```, ```DB_HOST``` and ```DB_PORT```
8
-
- run the API ```go run main.go```
9
-
- use import wizzard on mysql workbench to upload the [.csv file](https://github.com/Darklabel91/API_Names/blob/main/database/name_types.csv)
10
-
- have fun
5
+
## How to Run
11
6
12
-
## API
13
-
This project suports a simple CRUD. the main endpoint is ```/name``` where you can search for a name and it returns the name, metaphone code and all it's variations
7
+
Before running the API, make sure you have MySQL installed on your machine. Then, create a .env file and set the following environment variables:
8
+
```
9
+
DB_USERNAME
10
+
DB_PASSWORD
11
+
DB_NAME
12
+
DB_HOST
13
+
DB_PORT
14
+
SECRET
15
+
```
16
+
Finally, run the API using the command:
17
+
```go
18
+
go run main.go
19
+
```
14
20
15
-
Every method expect Status:200 and JSON content-type as show bellow:
21
+
## API Endpoints
22
+
The main endpoint for the API is ```http://localhost:8080/metaphone/:name```. You need to log in to get an access token before you can access any other endpoint. We use JWT to generate access tokens.
0 commit comments