CombAPI is a web API that allows the fetching of data from a sqlite database. The API was developed to have a full-stack application that interacts with a database, and performs queries to it, as well as using middleware to ensure the security of the application.
The database structure is loosely based on something you would find for VoIP applications like Discord.
The API has all three layers of a project:
- Presentation (basic HTML & CSS)
- Application (Node, Express, other middleware)
- Database (sqlite)
-
Node
- better-sqlite3
- body-parser
- express
- helmet
- morgan
- node-fetch
- pug
Clone the repository to your system.
git clone https://github.com/noxlock/CombAPI.git
Enter the root directory of the repo.
cd CombAPI
Install all required dependencies with NPM.
npm install
Once all the dependencies are installed, run the srv.js file in the src folder.
node ./src/srv.js
Simply enter the URL that was printed to the console into your web browser.
Note: connecting isn't needed to access the routes, it's just for those who prefer a GUI
The API can be accessed through the user-friendly GUI, or through the individual API routes.
It's really simple, navigate to the URL of the web server, and click on whatever option you'd like to perform.
This covers the back-end routes that interact with the database, NOT any of the GUI routes.
Displays all the users.
Displays a specific user's data
Displays the number of servers present in the database.
Displays the servers that the user is a member of.
Creates a user.
Before being inserted into the database, passwords are hashed using the crypto
library.
{
"user_id": integer,
"username": varchar,
"password": varchar,
Before being inserted into the database, passwords are hashed using the crypto
library."role": integer
}
Modifies a user's password field.
Before being inserted into the database, passwords are hashed using the crypto
library.
{
"new_password": varchar
}
Deletes a specific user, selected by :id
{
"user_id": integer
}
Displays ALL data from the database.
Displays all staff members (members with roles that have administrator
or moderator
field set to 1).
This program is under the MIT License, check LICENSE.md for more information.