/gethido-api

Node.js & MongoDB RESTful API for creating tools based on "Getting Things Done" time management method.

Primary LanguageJavaScriptMIT LicenseMIT

GeThiDo-API

GitHub package.json version GitHub code size in bytes GitHub last commit

GeThiDo-API is a RESTful API for creating tools based on "Getting Things Done" time management method.

Technologies

Project is created with:

  • Node.js
  • Express.js
  • MongoDB

Setup

To run this project:

  1. Clone this repository

    git clone https://github.com/michalmarchewczyk/gethido-api
  2. Install all dependencies

    npm install
  3. Generate public/private RSA key pair in PEM format and change filenames in auth/keys.js

    const privateKey = fs.readFileSync(path.join(__dirname, '[file_name].key'));
    const publicKey = fs.readFileSync(path.join(__dirname, '[file_name].pub.key'));
  4. Change database config in db/dbConfig.js

  5. Start the server

    npm start

Usage

GeThiDo-API is REST API with two types of endpoints:

Users API

For user-related actions endpoints have the form: https://[URL]/user/[endpoint]

Docs for user-related actions: docs/user.md

Tasks API

For tasks-related actions endpoint have the form: https://[URL]/tasks/[endpoint]

Docs for tasks-related actions: docs/tasks.md

Testing

GeThiDo-API uses Jest testing framework.

Setup tests

  1. (Optional) Setup temporary database for testing purposes, and change config in db/dbConfig.js

  2. Create user for testing purposes.

  3. Save this user's id in tasks/tasks.test.js

    const TEST_USER_ID = [userId];

Run tests

Run tests using npm

npm test

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT