Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

# RESTapi-Golang
RESTapi project with Go programming language

Routers


* GET a event detail - /event/:id
* GET all events - /events
* POST new event details - /event

Steps

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)