Skip to content

cazci/mlh

Repository files navigation

Notes API

A simple REST API for personal notes management

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Testing
  5. Tech And Reasons
  6. Alternate Features
  7. Contact
  8. Acknowledgements

About The Project

This API can handle personal notes in a multi-user environment. Currently the API has following functionalities.

  • Ability to save a new note
  • Ability to update a previously saved note
  • Ability to delete a saved note
  • Ability to archive a note
  • Ability to unarchive a previously archived note
  • Ability to list saved notes that aren't archived
  • Ability to list notes that are archived

Built With

Getting Started

Follow this guide to setup the project locally.

Prerequisites

  • npm
    $ npm install -g npm@latest

Installation

  1. Clone the repo
    $ git clone https://github.com/cazci/notes-api.git
  2. Install NPM packages
    $ npm install
  3. Rename config.example.ts to config.ts and update values
    const config = {
     mysql: {
       type: 'mysql',
       host: 'localhost',
       port: 3306,
       username: 'ENTER YOUR MYSQL USERNAME',
       password: 'ENTER YOUR MYSQL PASSWORD',
       database: 'ENTER YOUR MYSQL DATABASE NAME',
       autoLoadEntities: true,
       synchronize: true,
     },
     jwt: {
       secret: 'ENTER YOUR JWT SECRET',
     },
    };

Usage

Start Server

Run the following command to start the server. Server will be started on http://localhost:3000 by default.

$ npm run start

Screenshot 2021-08-07 at 17 40 04

Swagger Docs

Swagger is integrated with the API to generate Swagger docs which represents the API overview and endpoint details.

Navigate to http://localhost:3000/api-docs to access swagger docs.

Screenshot 2021-08-07 at 17 38 45

Serve Compodoc Docs

Compodoc is integrated with the API which represents the project structural overview and project roadmap.

Run the following command to serve the docs. Docs will be served on http://localhost:8080 by default.

$ npm run serve:docs

Screenshot 2021-08-07 at 17 41 59

Testing

The API has both Unit tests and E2E tests

Unit Tests

Run the following command to run the unit tests

$ npm run test

E2E Tests

Run the following command to run the e2e tests

$ npm run test:e2e

Tech And Reasons

NestJS - NestJS is a modern javascript framework for building efficient, scalable Node.js web applications. It has in-built support for popular JS libraries like express.js, rxjs, typeorm, and mongoose. Moreover, it combines the elements of OOP, FP and FRP and allows to code in Typescript.

Alternatives

  • Spring Boot
  • Rails
  • Flask

MySQL - For the simplicity of the project MySQL is a good relational database option.

Alternatives

  • PostgreSQL
  • MongoDB

Alternate Features

If I had more time to implement this I would try to,

  • Integrate timestamps (eg: created_at, updated_at)
  • Implement support for multiple input mechanisms (eg: images, voice notes)
  • Integrate a full-text search engine
  • Integrate OCR and SR features

Contact

Sashika Nawarathne - @cazci - [email protected]

Acknowledgements

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published