A simple RESTful message storing service
Publicly available at: http://ec2-52-42-73-248.us-west-2.compute.amazonaws.com:3000
- MySQL is used to store records in the database
- Express is used as middleware stack for API routes
- Angular is used as the JS Client Framework
- Node Is used along with Express for the server
To deploy this on Ubuntu 14.04 (feel free to try on your own system though) follow the instructions below!
Install the following prerequisites:
MySQL 5.5.57
(or higher)Node 8.6.0
(latest)
To run the e2e test you're also going to need:
Google-chrome 61.x
(or higher)Java SE Development Kit 8
Linux & OS X:
-
git clone https://github.com/AGontcharov/Qlik-project.git
-
cd Qlik-Project
-
sudo npm install
-
mysql -u root -p < init.sql
-
npm run wd-update
Next provide a config.json file in the root directory with the necessary crendentials:
{
"mysql": {
"user": "",
"password": "",
"database": "Qlik"
}
}
Windows:
Not yet available
Linux & OS X:
-
npm start
-
Open Chrome (or your favorite browser)
-
Go to: localhost:3000
URL: api/
Method: GET
URL Params: N/A
Data Params: N/A
Success Response Codes: 200
Success Response Content:
{
"version": "1.0",
"documentation": "https://github.com/AGontcharov/Qlik-Project"
}
Error Response Codes: N/A
URL: api/users
Method: POST
URL Params: N/A
Data Params:
{
"username": "Qlik"
}
Success Response Codes: 201
Success Response Content:
"User Created"
Error Resonse Codes:
- 400
"Missing username"
- 409
"Username already exists"
- 500
"Server error"
URL: api/users/login
Method: POST
URL Params: N/A
Data Params:
{
"username": "Qlik"
}
Success Response Codes: 200
Success Response Content:
'Authenticated'
Error Response Codes:
- 400
"Missing username"
- 404
"User does not exist"
- 500
"Server error"
Method: GET
URL: api/users
URL Params: N/A
Data Params: N/A
Success Response Codes: 200
Success Response Content:
[
{
"Username":"Alexander"
},
{
"Username":"Brandon"
},
{
"Username":"Chris"
}
]
Error Response Codes: 404 "No users are registered in the system"
Method: POST
URL: api/messages
URL Params: N/A
Data Params:
{
"username": "Qlik",
"subject": "Example",
"content": "This is the message body!"
}
Success Response Codes: 201
Success Response Content: "Message Submitted"
Error Response Codes:
- 400
"Missing subject"
- 400
"Missing content"
- 500
"Server error"
Method: GET
URL: api/messages
URL Params: N/A
Data Params: N/A
Success Response Codes: 200
Success Response Content:
[
{
"ID":1,
"MessageID":2,
"Subject":"First Message!",
"Date":"2017-09-30T23:29:43.000Z",
"Content":"I got here first!",
"Username":"Alexander"
},
{
"ID":5,
"MessageID":27,
"Subject":"Another Palindrome",
"Date":"2017-10-02T09:23:04.000Z",
"Content":"1234554321",
"Username":"Sergey"
}
]
Error Response Codes:
- 404
"Messages not found"
- 500
"Server error"
Method: GET
URL: api/messages/:id
URL Params: id must be a positive number!
Data Params: N/A
Success Response Codes: 200
Success Response Content:
[
{
"ID":1,
"MessageID":2,
"Subject":"First Message!",
"Date":"2017-09-30T23:29:43.000Z",
"Content":"I got here first!",
"Username":"Alexander"
}
]
Error response Codes:
- 404
"Message not found"
- 500
"Server error"
Method: DELETE
URL: api/messages/:id
URL Params: id must be a positive number
Data Params: N/A
Success Response Codes: 204
Success Response Content: "Message deleted"
Error Response Codes: 500 "Server error"
Linux & OS X:
Jasmine is used to run the unit tests through Karma and can be configured inside karma.conf.js.
npm test
Protractor is used to run the end-to-end test and can be configured inside protractor.conf.js.
-
npm start
-
npm run wd-start
-
npm run test-e2e
Alexander Gontcharov – [email protected]
Website - www.alexgontcharov.com