Simple backend service for personal websites
First of all, download and install Go. 1.14
or higher is required.
When installation is done clone the repo with command:
git clone https://github.com/nozgurozturk/noo-analytics
After that install missing dependencies with command:
go mod tidy
go run ./cmd/server
noo-analytics works with MongoDB and Redis
MongoDB Variables:
MONGO_DB_USERNAME =
MONGO_DB_PASSWORD =
MONGO_DB_HOST =
MONGO_DB_PORT =
MONGO_DB_NAME =
MONGO_DB_QUERY =
Redis Variables:
REDIS_DB_ADDRESS =
REDIS_DB_USERNAME =
REDIS_DB_PASSWORD =
Server Variables:
PORT =
ACCESS_SECRET =
REFRESH_SECRET =
# Hour
ACCESS_EXPIRE =
# Minute
REFRESH_EXPIRE =
ADMIN_MAIL =
POST /trace
{
"ip": "192.168.0.1",
"loc": "TUR",
"a": "Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/42.0",
"act": 1,
"tag": "home"
}
{}
- year, month, day and hour are objects are optional
- range and its properties are optional
POST /analytics/action/date
{
"action": 1,
"year":{
"isInclude": true,
"range": {
"from": 2018,
"to": 2020
}
},
"month":{
"isInclude": true,
"range": {
"from": 2018,
"to": 2020
}
},
"day":{
"isInclude": true,
"range": {
"from": 2018,
"to": 2020
}
},
"hour":{
"isInclude": true,
"range": {
"from": 2018,
"to": 2020
}
}
}
y: year | m: month | d: day | h: hour | v: visitors' ip | uv: unique visitors' ip
[
{
"y": 2020,
"m": 11,
"d": 6,
"h": 0,
"v": [
"192.168.0.1"
],
"uv": [
"192.168.0.1"
]
},
{
"y": 2020,
"m": 10,
"d": 6,
"h": 0,
"v": [
"192.168.0.1"
],
"uv": [
"192.168.0.1"
]
},
{
"y": 2020,
"m": 10,
"d": 4,
"h": 0,
"v": [
"192.168.0.1",
"192.168.0.2",
"192.168.0.1"
],
"uv": [
"192.168.0.1",
"192.168.0.2"
]
}
]
POST /auth/login
{
"email": "[email protected]",
"password": "sample_password"
}
{
"name": "Sample Name",
"email": "[email protected]"
}
POST /auth/signup
{
"name": "Sample Name",
"email": "[email protected]",
"password": "sample_password"
}
{
"name": "Sample Name",
"email": "[email protected]"
}
{
"message": "Not Accessible",
"error": "unauthorized",
"status": 401
}