Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/basemax/graphneo4jgo

This is a simple twitter-like api written in go as an example to use neo4j with golang. (postgresql, neo4j, graph)
https://github.com/basemax/graphneo4jgo

api go go-api go-neo4j go-postgresql neo4j neo4j-database neo4j-go neo4j-graph neo4j-tutorial postgresql restful restful-api restful-webservices restfulapi

Last synced: 1 day ago
JSON representation

This is a simple twitter-like api written in go as an example to use neo4j with golang. (postgresql, neo4j, graph)

Awesome Lists containing this project

README

        

# Graph Neo4j Go

This is a simple twitter-like api written in go as an example to use neo4j with golang.

### Technologies

- [neo4j](https://neo4j.com/)
- postgresql
- [mux](https://github.com/gorilla/mux)
- [jwt](https://github.com/golang-jwt/jwt)
- [go-playground/validator](https://github.com/go-playground/validator)

### Api documentation
A guide for endpoints.

#### User endpoints
Base path: `host://api/v1/user`

- **Register**
- Path: `/register/`
- Method: `POST`
- Request body:
```json
{
"username": "username_length_higher_than_6",
"name": "name of user",
"email": "[email protected]",
"password":"a_good_password",
"gender": 1
}
```
- Response:
```json
{
"status": "Created",
"id": 5,
"token": ""
}
```

- Description: available genders are: Male=1, Female=2, Other=3. use token to access authenticated endpoints.

- **Login**
- Path: `/login/`
- Method: `POST`
- Request body:
```json
{
"username": "username",
"password": "user_password"
}
```
- Response body:
```json
{
"status": "Found",
"id": 5,
"token": ""
}
```

- **Info**
- _**Auth**_ : need jwt token in headers as Bearer token.
- Path: `/info/{username}`
- Method: `GET`
- Response Body:
```json
{
"status": "Found",
"data": {
"id": 3,
"username": "username",
"name": "users name",
"email": "[email protected]",
"gender": 1
}
}
```

- **Delete**
- _**Auth**_
- Path: `/delete/`
- Method: `DELETE`
- Response Body:
```json
{
"status": "Deleted",
"id": 4
}
```

Copyright 2023, Max Base