A simple REST API for personal notes management
Table of Contents
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
Follow this guide to setup the project locally.
- npm
$ npm install -g npm@latest
- Clone the repo
$ git clone https://github.com/cazci/notes-api.git
- Install NPM packages
$ npm install
- Rename
config.example.ts
toconfig.ts
and update valuesconst 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', }, };
Run the following command to start the server. Server will be started on http://localhost:3000 by default.
$ npm run start
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.
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
The API has both Unit tests and E2E tests
Run the following command to run the unit tests
$ npm run test
Run the following command to run the e2e tests
$ npm run test:e2e
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
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
Sashika Nawarathne - @cazci - [email protected]