No description
src | ||
tests | ||
.gitignore | ||
db6.sqlite3 | ||
n3.nimble | ||
README.MD |
Authentication API
Introduction
This is a README file for a newly developed Authentication API built with Nim on the backend and HTML5 and CSS3 for potential client applications.
Project Support Features
- Users can signup and login to their accounts
- Public (non-authenticated) users can access all causes on the platform
- Authenticated users can access all causes as well as create a new cause, edit their created cause and also delete what they've created.
Installation Guide
- Clone this repository here.
- The develop branch is the most stable branch at any given time, ensure you're working from it.
- Run nimble install to install all dependencies
- You need to install SQLite3 on your device.
Usage
- Run nim c -r src/n3.nim to start the application.
- Connect to the API using Postman on port 8080.
API Endpoints
HTTP Verbs | Endpoints | Action |
---|---|---|
POST | /api/signup | To sign up a new user account |
POST | /api/login | To login an existing user account |
GET | /signup | To sign up a new user account through the browser |
GET | /login | To login a new user account through the browser |
Expanded API Endpoint Details
Signing Up a New User using API
- Endpoint:
POST /api/signup
- How to use:
/api/signup?username={newUser}&email={Email}&password={Password}
- Payload Example:
{ "status": "success", "message": "User created successfully" }
- Description:This endpoint is used to create a new user account. The request should include a JSON payload with a
username
,email
andpassword
.
Logging in an Existing User using API
- Endpoint:
POST /api/login
- How to use:
/api/login?username={newUser}&password={Password}
- Payload Example:
{ "message": "Login successful", "username": "newUser", "email": "ee@rrr.tt", "password": "password123" }
- Description:This endpoint is used to login an existing user account. The request should include a JSON payload with a
username
andpassword
.
Signing Up a New User using Browser (Recommended)
- Endpoint:
GET /signup
- How to use: redirect to
/signup
on your browser - Payload Example:
{ "status": "success", "message": "User created successfully" }
- Description:This endpoint is used to create a new user account. The request should include a JSON payload with a
username
,email
andpassword
.
Logging in an Existing User using Browser (Recommended)
- Endpoint:
GET /login
- How to use: redirect to
/login
on your browser - Payload Example:
{ "message": "Login successful", "username": "newUser", "email": "ee@rrr.tt", "password": "password123" }
- Description:This endpoint is used to login an existing user account. The request should include a JSON payload with a
username
andpassword
.
Technologies Used
- Nim This is a cross-platform runtime environment built on Chrome's V8 JavaScript engine used in running JavaScript codes on the server. It allows for installation and managing of dependencies and communication with databases.
- Mike This is a NodeJS web application framework.
- SQLite3 This is a free open source NOSQL document database with scalability and flexibility. Data are stored in flexible JSON-like documents.