Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatihbaltaci/restapi-golang
RESTapi project with Go programming language
https://github.com/fatihbaltaci/restapi-golang
Last synced: 10 days ago
JSON representation
RESTapi project with Go programming language
- Host: GitHub
- URL: https://github.com/fatihbaltaci/restapi-golang
- Owner: fatihbaltaci
- Created: 2017-03-02T00:15:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-02T00:55:25.000Z (over 7 years ago)
- Last Synced: 2023-09-07T15:13:49.350Z (about 1 year ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RESTapi-Golang
RESTapi project with Go programming languageRouters
* GET a event detail - /event/:id
* GET all events - /events
* POST new event details - /eventSteps
1. Create Database and Tables
Run `RESTapi_Go_Database.sql` file in MySQL database. EER Diagram of this database is shown below.
![alt tag](https://cloud.githubusercontent.com/assets/10353650/23487538/70191d5a-feef-11e6-8840-a39a911ea30d.png)
2. Get all the dependencies
In the `main.go` file there are 2 imports from github. To get the dependencies:
```
go get
```3. Build and Run
First of all, change username, password for MySQL connection on 17th line in main.go
```
go build main.go
main
```
![alt tag](https://cloud.githubusercontent.com/assets/10353650/23487725/abf23c5c-fef0-11e6-9fee-bebb08c5b35f.PNG)4. Test
```
GET localhost:3001/events
```
![5](https://cloud.githubusercontent.com/assets/10353650/23487972/5090536a-fef2-11e6-8394-cc78a72fae68.PNG)```
GET localhost:3001/event/5
```
![6](https://cloud.githubusercontent.com/assets/10353650/23487973/50b66bf4-fef2-11e6-80da-915139cf8794.PNG)```
POST localhost:3001/event
```
![7](https://cloud.githubusercontent.com/assets/10353650/23487974/50ca9200-fef2-11e6-8cbd-d1bd790b5c0f.PNG)