Super Tic-Tac-Toe
Software Engineering 2 project deliverable. See the documents folder for more info.
PreRequisite
- xampp application to run MySQL database and Apache server Download from here.
- Download Node js LTS version and install it in your operating system. Download from here
- Postman a desktop app or you can use it chrome extension for API testing.Download from here
Table Creation In DB
- Create Table
user
withid,email,username,password
columns, see file indocuments/user.sql
.
Get Started
- Clone this repo
$ git clone https://github.com/comphonia/super_tic-tac-toe_backend.git
- Navigate into the cloned directory and install the dependencies
cd super_tic-tac-toe_backend
$ npm install
- Launch Environment:
$ npm start
- Open in browser:
- open
http://localhost:9890
- open
API Usage
Utilize postman to make requests for the best experience as browsers only serve a [GET] resource by default.
- signup route -
http://localhost:9890/api/signup
- pass json object containing email, username and password [POST].
- login route -
http://localhost:9890/api/login
- pass json object containing email, username and password [POST].
- other CRUD route are in the secureApi - e.g.
localhost:9890/secureApi/user
.- In all GET, PUT, DELETE and POST request you will need the
token
in header which is issued after a successful login.
- In all GET, PUT, DELETE and POST request you will need the
Example object for login request (body as JSON object) -
{
"username":"test",
"password":"testpass"
}
Note: You have to pass the
token
for each request as "header" while accessing the/secureApi
.
Features
- Basic operations
Create
,Read
,Update
andDelete
. - Uses Express framework.
- Uses JWT Token for security and authentication of API.
- MVC structure in which
Route
,Service
andModel
layer. - Uses AJV as schema validator which validate request and response schema.
- Uses Connection Pooling which lead to reduce number of connection at any point of time and reduce stress in DB which leads to better availability and Performance of DB.
- Uses common error structure format for all type of error throwing in Application.
nodemailer
is used to send mail over SMTP.bcryptjs
is used to encrypt your password through salt and hashing technique and which won't store password as plain text in database.