datcal / notepad-api

api for the notepad application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Build Status

notepad-api

Api for the notepad application

You can deploy the notepad application yourself. See the live example

https://notepad-api-datcal.herokuapp.com

Docs

Set up

First, clone the repo. Copy the .env.example file to .env (which will be ignored by Git):

cp .env.example .env

Configuring Database

  1. Go to the MongoDB Atlas Console and create a new database
  2. Get to database uri and paste this in your .env file

Configuring JWT

  1. Define a secret key and enter in your .env file
API_SECRET_KEY=SOME_LONG_TEXT

Configuring Test Process

  1. Define test user mail and password and enter it into your .env file
TESTUSER=email

TESTUSERPASSWORD=password

Run Your Project

In the project folder, run:

npm install

npm start

Notes

Route HTTP Verb POST body Header Description
/notes GET Empty x-access-token=token List all notes.
/notes POST {'content':'foo'} x-access-token=token Create a new note.
/notes/:id GET Empty x-access-token=token Get a note.
/notes/:id PUT {'content':'bar'} x-access-token=token Update a note with new info.
/notes/:id DELETE Empty x-access-token=token Delete a note.

User

Route HTTP Verb POST body Description
/user/register POST {'mail' : 'test@test.com', 'password' : 'password','fullname' : 'Name Surname'} Create a new user.
/user/login POST {'mail' : 'test@test.com', 'password' : 'password'} Login user and generate a token.

About

api for the notepad application

License:MIT License


Languages

Language:JavaScript 96.2%Language:Pug 2.1%Language:CSS 0.9%Language:Shell 0.7%