Skip to content

This project is a simple Restful API backend written with Deno and Express.

Notifications You must be signed in to change notification settings

Abdulkareemoj/REST-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST-Deno

Overview

REST-Deno is a simple Restful API backend written with Deno and Express. This project demonstrates how to build a RESTful API using Deno, a modern runtime for JavaScript and TypeScript, and Express, a minimal and flexible Node.js web application framework. Original Project uses the server written in Node.js here

Features

  • User authentication with JWT
  • Google OAuth2 authentication
  • Role-based access control (RBAC)
  • CRUD operations for products and posts
  • Session management
  • Input validation with Zod
  • MongoDB integration with Mongoose

Project Structure

node-react-ts-docker/
├── src/ # Source code
│ └── ... # Other configuration files
├── .gitignore
├── deno.json
├── deno.lock
└── README.md

Getting Started

Prerequisites

  • Deno
  • MongoDB Database
  • A terminal/CLI with Git
  • A Text Editor or IDE of your choice

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/rest-deno.git
cd rest-deno
  1. Rename the [.env.template] file to [.env] and fill in the required environment variables

  2. Install dependencies:

deno install

Running the Application

Start the development server:

deno task dev

The server will start on the port specified in the .env file.

API Endpoints

Authentication

  • POST /api/signin - Sign in a user
  • POST /api/signout - Sign out a user

Users

  • POST /api/users - Create a new user

Sessions

  • POST /api/sessions - Create a new session
  • GET /api/sessions - Get user sessions
  • DELETE /api/sessions - Delete a session

Products

  • POST /api/products - Create a new product
  • PUT /api/products/:productId - Update a product
  • GET /api/products/:productId - Get a product
  • DELETE /api/products/:productId - Delete a product

Posts

  • POST /api/posts - Create a new post
  • PUT /api/posts/:postId - Update a post
  • GET /api/posts/:postId - Get a post
  • DELETE /api/posts/:postId - Delete a post

License

This project is licensed under the MIT License.

About

This project is a simple Restful API backend written with Deno and Express.

Resources

Stars

Watchers

Forks