Coder Social home page Coder Social logo

nkowaokwu / igbo_api Goto Github PK

View Code? Open in Web Editor NEW
306.0 14.0 136.0 17.45 MB

An API exposing Igbo words, definitions, and more

Home Page: https://igboapi.com

License: Apache License 2.0

JavaScript 7.30% Dockerfile 0.02% CSS 0.24% TypeScript 90.42% MDX 2.02%
igbo dictionary-api igbo-api dictionary igbo-language mongodb

igbo_api's Introduction

Igbo API

Deploy to Firebase Dockerize Igbo API

Contributing | Documentation | Code of Conduct | Slack Channel

Igbo is the principal native language of the Igbo people, an ethnic group of southeastern Nigeria, and is spoken by approx 45 million people with more than 20 different dialects.

Features ๐Ÿงฑ

๐Ÿ“š 4,500+ Igbo words, 5,000+ dialectal variations, 17,000+ Igbo example sentences

โœ๐Ÿพ English and Igbo definitions

๐Ÿ—ฃ Audio pronunciations for words and examples

๐Ÿ”Ž Full-text search with diacritic support

๐Ÿš€ Try out a demo here

Getting Started

Let's get the Igbo API running locally on your machine.

0. Prerequisites

To run this project locally, please install the following:

1. Installation

Clone the project:

git clone https://github.com/nkowaokwu/igbo_api.git

Note: It's recommended to have NVM installed so you can easily switch between Node versions that are required in this project.

Navigate into the project directory and install its dependencies:

cd igbo_api/
npm install

Build the frontend for the site:

npm run build

2. Connect Firebase Project

This project uses Firebase and requires you to create your own free Firebase project.

Please follow the Firebase Configuration Guide here

3. Local Development

Once you've configured your project, you can start the Igbo API dev server by running:

npm run dev

Navigate to localhost:3000 to see the UI.

Use localhost:8080/igbo-api-staging-99a67/us-central1/api/api to access the API.

Optional: Development with Replica Sets and Redis

To start the dev API server while running MongoDB Replica sets and the Redis cache, run:

npm run dev:full:database

To start a Redis server, run:

redis-server

Warning: Running replica sets locally is machine-intensive and should only be ran for testing or specific-feature development purposes.

Reminder: You must have Redis installed on your machine in order to run the server.

Project Start-Up Alternative: Docker

If you don't want to run a local Node and MongoDB, you can use Docker

Run the following command:

npm run start:docker

Navigate to localhost:8080 to see the API

Seeding the Database ๐ŸŒฑ

To populate the database complete the following steps:

Option 1. Build a Dictionary

The following command places the JSON dictionaries in the build/ directory:

npm run build:dictionaries

Here's an example JSON dictionary file: ig-en/ig-en_expanded.json

Option 2. Populate the MongoDB Database

Now that the data has been parsed, it needs to be used to populate, or seed, the MongoDB database.

Start the development server:

npm run dev

Then make a POST request to the following route:

/api/v1/test/populate

For example:

http://localhost:8080/api/v1/test/populate // POST

After about 20 seconds, if you see the โœ… Seeding successful. message in your terminal, then you have successfully populated your database.

Verify database seeding was successful

Install one of the options on your machine to view the seeded data

Option 1: Download MongoDB Compass

https://docs.mongodb.com/manual/administration/install-community/

Option 2: Install MongoDB VSCode extension

https://marketplace.visualstudio.com/items?itemName=mongodb.mongodb-vscode

Connect to your local mongodb cluster using this connection:

mongodb://127.0.0.1:27017/igbo_api

(Optional) Migrate Data

The database has gone through a number of migrations since the beginning of this project. To ensure that local testing data is the same shape as the data in the production MongoDB database, run all MongoDB migration scripts with the following command:

npm run migrate-up

Testing

Frontend

Frontend tests focus specifically on the Igbo API homepage using Cypress. First, run:

npm run build

To watch frontend tests, run:

npm run cypress

Backend

Backend tests use both locally stored MongoDB and JSON data, so to spin up an instance of MongoDB and start the tests at the same time, run:

npm run test

If you want to run your MongoDB instance and tests in separate terminals, you can run:

Next Steps

Visit our ๐Ÿ“š documentation website to learn how to use the Igbo API within your own project.

export FIREBASE_AUTH_EMULATOR_HOST="http://localhost:9799" && yarn start

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.