Skip to content

EteimZ/lingo-backend

Repository files navigation

Lingo-backend

The backend code base for lingo.

What is Lingo?

Lingo is an app that let's users communicate with one another without having knowledge of the each other's language. It tries to break the language barrier among humans. It does this by using instant translation. This prevents the user from going back and forth to translate messages.

lingo drawio

Technologies

  • express: This will be used to handle regular http requests.

  • socket.io: This is used for real-time communication.

  • MongoDB: Database to store users message.

  • Redis: Database to store user sessions.

  • google-translate-api: Node implementation of google translate api.

Figma design can be found here by Lois Dagana

Usage

In other to run the app, you have to have docker installed.

Create a .env in the main directory then copy and paste the text below.

MONGO_URI="mongodb://lingo_user:lingo_pwd@mongo/lingo_db"
PORT=3000
SECRET="4274fffc957f5a2f5dabe93ea26c3b6c5ed95e9aac8111e2614d7adcb809986a"

The SECRET variable can be changed to any value you desire but its safe to keep it random.

Then run the command below:

docker compose up -d # or docker-compose up -d

API

API routes for basic crud operations:

Test route:

GET 127.0.0.1:9000/

Response:

{"msg":"Lingo up"}

Get users route:

GET 127.0.0.1:9000/api/users/

Response:

 [
   {
    "_id": "630aaff5960b85d32420f516",
    "username": "Eteims",
    "friends": [],
    "groups": [
      "French",
      "Spanish"
    ],
    "createdAt": "2022-08-27T23:59:49.972Z",
    "updatedAt": "2022-08-28T00:02:17.882Z",
    "__v": 0,
    "lang": "English"
  },
  {
    "_id": "630ab174044d4c24d5e27d36",
    "username": "Alice",
    "friends": [],
    "groups": [],
    "createdAt": "2022-08-28T00:06:12.227Z",
    "updatedAt": "2022-08-28T00:06:12.227Z",
    "__v": 0
  },
 ]

Get user route:

GET 127.0.0.1:9000/api/users/630aaff5960b85d32420f516

Response:

{
  "_id": "630aaff5960b85d32420f516",
  "username": "Eteims",
  "friends": [],
  "groups": [
    "French",
    "Spanish"
  ],
  "createdAt": "2022-08-27T23:59:49.972Z",
  "updatedAt": "2022-08-28T00:02:17.882Z",
  "__v": 0,
  "lang": "English"
}

Signup route:

POST 127.0.0.1:9000/api/users/signup

Request body:

{
    "username": "Alice",
    "password": "alice123"
}

Login route:

POST 127.0.0.1:9000/api/users/login

Request body:

{
    "username": "Alice",
    "password": "alice123"
}

Add lang route:

PATCH 127.0.0.1:9000/api/users/lang

Request body:

{
    "lang": "English",
    "groups": ["Spanish", "Igbo", "French"]
}

Delete route:

DELETE 127.0.0.1:9000/api/users/

Note: User most be signed in!

Response:

{ "detail": "User successfully deleted" }

Tasks

  • Setup environments

    • setup typescript environment for express.
    • setup database mongodb via docker.
    • Run a simple test app.
  • Create database schema for users.

  • Implement login functionality.

About

The backend code base of lingo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors