fluminus / api_server

Server for registering and deactivating push notification service for Fluminus app.

Home Page:https://api.tyhome.site

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fluminus Server

Get Started

Database config

drop table if exists fluminus.pn;
drop table if exists fluminus.notification;
create table if not exists fluminus.pn(
	user_id varchar(255) primary key,
  idsrv varchar(1023),
  jwt varchar(1023),
  fcm_token varchar(255),
  entry_time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
set time_zone='+08:00';
create table if not exists fluminus.notification(
	user_id varchar(255),
  id integer
);

Request format

/api/activate_pn HTTP POST

{
  "idsrv": "idsrv",
  "jwt": "jwt",
  "fcm_token": "fcm_token"
}

/api/deactivate_pn HTTP DELETE

{
  "idsrv": "idsrv",
  "jwt": "jwt"
}

Production mode

  • Configure prod.secret.exs file
config :fluminus_server, FluminusServerWeb.Endpoint,
http: [:inet6, port: String.to_integer(System.get_env("API_SERVER_PORT") || "23333")],
secret_key_base: secret_key_base
  • Configure prod.exs file
config :fluminus_server, FluminusServerWeb.Endpoint,
url: [host: "your_running_url", port: 23333],
cache_static_manifest: "priv/static/cache_manifest.json"
  • Some commands
export API_SERVER_PORT=23333
mix phx.gen.secret
export SECRET_KEY_BASE=[the secret generated just now]
export DATABASE_URL=ecto://[username]:[password]@localhost/[database_name]
mix phx.digest
mix deps.get --only prod
MIX_ENV=prod mix phx.server

Extras

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Ready to run in production? Please check our deployment guides.

About

Server for registering and deactivating push notification service for Fluminus app.

https://api.tyhome.site


Languages

Language:Elixir 73.4%Language:CSS 19.7%Language:JavaScript 6.9%