A REST API based application to compare essay submissions for similarity.
- Nodejs
- PostgreSQL
- Sequelize
- Users can
- Sign in
- Generate reports by comparing text files
- View reports history
- View specific reports
- Delete reports
To run this API locally simply follow the instructions below:
You need to have or install the following:
- Git bash
- Npm
- Postman
-
clone repo
git clone https://github.com/fegoworks/essay-checker.git
-
navigate to api folder
-
run installation
npm install
-
create a
.env
file with this templateDATABASE_URL = 'Your postgres database url' DATABASE_URL_TEST = 'Your postgres test database url' DATABASE_URL_DEVELOPMENT = 'Your postgres database url' PORT = 'Your local port' SECRET = 'Your secret phrase' CLOUD_NAME = 'Your cloudinary cloud name' CLOUDINARY_API_KEY = 'cloudinary api key' CLOUDINARY_API_SECRET = 'cloudinary api secret'
-
run migrations
npm run migrate
-
start app
npm run start:dev
-
you can now make requests using postman to
localhost:3000/api/v1/
To run tests simply run the following command in your git bash or command line
npm run test
Heroku: Essay-Checker-API Documentation: Essay-Checker-API-Docs
Endpoints | Functionality |
---|---|
POST /auth/create-user | Create new user account |
POST /auth/signin | Login a user |
POST /reports | Compare texts and generate a report |
GET /reports | View reports history |
GET /reports/:reportId | View a specific report |
DELETE /reports/:reportId | Remove a particular report |
Send a POST
request to /api/v1/auth/create-user
with the following JSON structure:
{
"firstName": "Sensei",
"lastName": "Saitama",
"email": "saitama@mail.com",
"password": "password"
}
Send a POST
request to /api/v1/auth/signin
, with the following:
{
"email": ,
"password":
}
When you signin you'll receive a Bearer token
. You'll need this token to send any request related to reports.
Frow now on, every request described here will require you send the Bearer token
Send a POST
request to /api/v1/reports
, with the following:
{
"studentOne": "fego",
"studentTwo": "gbenga",
"essay": article.txt,
"essay": article2.txt
}
The above should be in a multipart form, with keywords essay
being file fields.
Send a GET
request to /api/v1/reports/
Send a GET
request to /api/v1/reports/:reportId
, with the following:
Delete a report by placing its id in the DELETE
request URL
/api/v1/reports/:reportId
.
Edafe Oghenefego @realFego