A Node.js server using,
-
Expressjs
-
REST and GraphQL
-
AWS Services: RDS, S3
-
MySQL with Docker
-
Winston Logger
-
Swagger Documentation
- Clone the Github Project
git clone <github link>
- Install the dependencies and devDependencies
cd /personal-notes-manager
npm install
- Configure Terraform
Set config.aws_services
variable in config.js
to true
Create secret.tfvars
file in the root directory and add the following AWS credentials,
# AWS CONFIGS
AWS_REGION="<region>"
AWS_ACCESS_KEY="<access_key>"
AWS_SECRET_KEY="<secret_key>"
# DATABASE CONFIGS
username="<username>"
password="<password>"
Initialize AWS resources
terraform init
terraform apply -var-file="secret.tfvars" -lock=false --auto-approve
Copy `aws_db_instance_address` shown in CLI to `ENDPOINT` variable in `.env` file.
- Configure local database
Set config.aws_services
variable in config.js
to false
Run docker mysql
docker-compose up
- Start the Server
npm start
- Create the database tables manually.
The frontend application should call the implemented backend endpoints.
In the development phase, the server is run on localhost
in the port 3000
Both database and server configurations can be found in the app/config.js
file.
The endpoint should be called by adding the prefix http://<host>:<port>/api/
to the below endpoints.
Currently configured to http://localhost:3000/api/
-
GET /notes
- Get all notes -
GET /notes/:user_id
- Get notes by user_id -
GET /note/:note_id
- Get note by note_id -
POST /notes
- Add a new note -
PUT /notes
- Update a previously saved note -
DELETE /notes/:note_id
- Delete a note -
POST /upload
- Upload an image
- GraphQL endpoints to be updated
Swagger API documentation is available with more information.
http://localhost:3000/api-docs
- CRUD functionalities for notes
- Upload an image
- CRUD functionalities for users
app
├── config.js
├── connection.js
├── graphql
│ ├── mutation.js
│ ├── query.js
│ ├── schema.js
│ └── types
│ └── user.js
├── index.js
├── logger
│ └── logger.js
├── notes
│ ├── note.js
│ └── note.test.js
├── server.js
└── uploads
└── upload.js