Giter Club home page Giter Club logo

fluent-api's Introduction

fluent Api

Welcome to fluent, an app where you can practice learning a language with the spaced reptition revision technique.

fluent Api is the backend for fluent. To see fluent in action, check out fluent.

The fluent frontend can be found at: fluent-client

fluent supports the creation of your own user account. If you'd like to see it in action before signing up, use the demo account details below.

demo account details

  • username: admin
  • password: pass

what is spaced repetition?

Spaced repetition is a learning technique which exploits the psychological spacing effect. Within fluent, this means that words that you translate correctly will pop up with increasingly less frequency with consecutive correct answers. Conversely, get a word wrong and that word will begin to pop up more frequently.

table of contents.

the tech.

backend.

  • Node and Express
    • Authentication via JWT
    • RESTful Api
  • Testing
    • Supertest (integration)
    • Mocha and Chai (unit)
  • Database
    • Postgres
    • Knex.js - SQL wrapper

production.

Deployed via Heroku

setup.

requirements.

  • Postgres v8.5.1
  • Node v15.11.0

local setup.

Clone this repository to your local machine

git clone https://github.com/trevorjalt/fluent-api fluent-api

Change directory into the cloned repository

cd fluent-api

Make a fresh start of the git history for this project

rm -rf .git && git init

Install the node dependencies

npm install

Start the Postgres server

pg_ctl start

Create the development user

createuser -Pw --interactive 

Type kakarot for the name of the role to add

Select y when asked if the user should be a super user

Press return (enter) for no password

Create the development databases

createdb -U kakarot fluent && createdb -U kakarot fluent-test

Create a .env file in the project root, and include the following:

NODE_ENV=development
PORT=8000
TZ='UTC'
MIGRATION_DB_HOST=127.0.0.1
MIGRATION_DB_PORT=5432
MIGRATION_DB_NAME=fluent-test
MIGRATION_DB_USER=kakarot
MIGRATION_DB_PASS=
DB_URL="postgresql://kakarot@localhost/fluent"
TEST_DB_URL="postgresql://kakarot@localhost/fluent-test"
JWT_SECRET="spaced-repetition-jwt-secret"

Run the migrations for the development test database

npm run migrate:test

Update the following in the .env

MIGRATION_DB_NAME=fluent

Run the migrations for the development database

npm run migrate

Seed the development database

psql -U kakarot -d fluent -f ./seeds/seed.tables.sql

quick start scripts.

Run the fluent tests

npm t

Start the application

npm start

Start nodemon for the application

npm run dev

endpoints.

overview.

  • endpoints
    • /api/user
    • /api/auth
    • /api/language
    • /api/language/head
    • /api/language/guess

authentication.

fluent is supported by JWT authentication. A valid username and password must be posted to the /api/auth/token/ endpoint. This will return a bearer token that must be included in the header for all protected endpoints. To create a valid user, see /api/user/

public endpoints.

/api/user/

  • POST

request body requires:

{
  name: '',
  username: '',
  password: ''
}

/api/auth/token

  • POST

request body requires:

{
  username: '',
  password: ''
}

protected endpoints.

/api/language

  • GET

Header must include a JWT Token

request body requires

{
  language_id: [number],
  user_id: [number]
}

/api/language/head

  • GET

Header must include a JWT Token

request body requires

{
  language_id: [number]
}

/api/language/guess

  • POST

Header must include a JWT Token

request body requires:

{
  guess: ''
}

lets get fluent.

fluent-api's People

Contributors

trevorjalt avatar

Watchers

 avatar

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.