Git Product home page Git Product logo

forma-core's Introduction

forma-core

RESTful API service to create, read, update and delete data from the web and mobile applications.

Usage

1. Clone this repository using the terminal command or GitHub Desktop.

git clone https://github.com/Forma-AT/forma-core.git

2. Install the dependencies using npm

npm i

3. Create a file in the project root directory named .env and place the following content in it. Make sure to replace these placeholder values with the actual secrets and connection details you wish to use. The recommended JWT secret is an at least 20 characters long random generated string.

PORT=5000
MONGODB_HOST="localhost"
MONGODB_PORT=27017
MONGODB_POOLSIZE=20
MONGODB_NAME="forma"
JWT_SECRET=""

4. Start the server in development mode with TypeScript compilation and hot-reloading enabled

npm run dev

5a. (optional) Compile source code manually

npm run build

5b. (optional) Start the server in production mode

npm run prod

6. Access the API using any client (e.g. Postman) at

http://localhost:5000/api

API endpoints

For an exhaustive list of all available API endpoints, authorization information, request and response parameters, as well as request and response samples view the API documentation written in OpenAPI 3 format at docs/core-api.yaml. To run a user-friendly API documentation server using redoc-cli run the following command:

npm run api

or to run the API server in watch mode (no hot-reloading)

npm run api:dev

and then open the documentation server in the browser at

http://localhost:8080/

Generate mock data

When testing the API endpoints or the front-end UI it can come in handy to have test users ready, and manual creation can be tedious. The following command will generate 15 school and 15 teacher accounts, all fully configured and set up. None of the users will have memberships or classes by default.

npm run gen-mock-data

Keep in mind that this should only be run once, otherwise you might end up with duplicate users. To customize the mock data before running the command you can edit the files under scripts/mock. The generated users will have the following format by default:

Type Email Password
school [email protected] Testing123
school [email protected] Testing123
... ... ...
school [email protected] Testing123
school [email protected] Testing123
teacher [email protected] Testing123
teacher [email protected] Testing123
... ... ...
teacher [email protected] Testing123
teacher [email protected] Testing123

forma-core's People

Contributors

andras-adam avatar dependabot[bot] avatar

forma-core's Issues

Implement skills API

  • Teacher accounts can have skills
  • Skill can be subject or language
  • Skills and languages can be selected from an existing list
  • Skills can be added, removed and viewed
  • Skills are included in the teacher's data

Improve security

  • Consider safer authorization than JWT
  • Consider limits for creating resources as to prevent processing too much data at once
  • Implement limits or pagination for database queries
  • Discriminate against non-confirmed users
  • Paging findMany queries
  • Fault tolerance in findMany queries (undefined result in array)

Implement class API

  • School accounts can create classes
  • Classes have title, startDate, endDate, description and subject
  • Teachers can view classes matching their skills
  • Teachers can apply/withdraw from class
  • School admin can delete and update classes

Implement teacher API

  • Implement API endpoints for users to join/leave school
  • School admins can accept/reject join requests, and remove teachers

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.