Giter Club home page Giter Club logo

todo-server-deno's Introduction

** This was a throwaway project I started for a course I wanted to create, I might create a medium article instead, feel free to use, copy, whatever =).

todo-server-deno

Topics that needs to be covered

  • covering typescript, since deno is pure typescript

  • deno under the hood - using tokio library (instead of libuv), compiles typescript directly which means slower compile time, but faster runtime...

  • the deno ecosystem, no npm, we use deno/x

  • the deno cli

  • how to write tests in deno

Libraries used:

mock

a library used to spy on functions and create stubs for tests

dotenv

a library used to read .env file and manage environment variables

value_schema

similar to node's joi, used to validate input

mongo

mongodb implementation based on rust

bcrypt, uuid (from std), djwt (jwt implementation)

how to authenticate, manage distributed sessions with cookies, and proper authentication

Oak

express like library, context based (influenced from GO)

Denon

script runner for deno, like nodemon

to install globally, you need to add "$HOME/.deno/bin" to path variable so denon packages can be used globally

could be different in windows/linux, show how to find it using "denon install --help"

Start project:

  • denon (requires denon to be installed)

  • deno run --allow-all --unstable src/index.ts runnin quickly (unsafe), the unstable flag is for the deno plugins feature (used by mongodb)

Run test

  • deno test --allow-all --unstable

API

Public endpoints

  • POST /auth/login -> login as user, requires password and email fields, registers a cookie and creates a session id
  • POST /auth/register -> create a new user, requires password and email fields, registers a cookie and creates a session id

Protected endpoints

  • GET /auth/logout -> logs a user out by invalidating the session ID, and clearing the cookies
  • POST /todo -> create a new todo (accepts text)
  • GET /todo -> returns all the todos for the logged in user
  • GET /todo/:id -> returns a single todo by id
  • PUT /todo/:id -> updates a todo (only text or done)
  • DELETE /todo/:id -> delete a todo by id

todo-server-deno's People

Contributors

liron-navon avatar

Stargazers

Vyas Ramankulangara avatar opensas avatar Mike Wilcox avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.