Giter Site home page Giter Site logo

hb's Introduction

HOMEBASE Assignment

Deployment Instruction

0. Preparation

  • Source code: https://github.com/khacduylam/hb
  • Environment:
    • node_server
      • Node: v16.16.0
      • Npm: v8.11.0
    • djano_server
      • Python: v3.11.4
      • Django: v5.0
      • Django-admin: v5.0
      • Requests: v2.31.0
    • proxy
      • Python: v3.11.4
      • Requests: v2.31.0

1. NodeJs Express Server

# Move to `node_server` folder
$ cd node_server/

# Copy `example.env` to `.env` file 
$ cp example.env .env

# Install dependencies 
$ npm install

# Start server(dev mode)
$ npm run start:dev

# Check if the server is started successfully 
$ curl localhost:3060/health 
# if success, a text `Hello World!` will be printed!

# Testing CRUD APIs 
+ Get by id: [GET] http://localhost:3060/api/users/{id}
+ Get all: [GET] http://localhost:3060/api/users
+ Create: [POST] http://localhost:3060/api/users
{
    "fullName": "Khac Duy Lam",
    "age": 25,
    "sex": "Male"
}
+ Update: [PUT] http://localhost:3060/api/users/{id}
{
    "fullName": "Khac Duy Lam updated",
    "age": 26,
    "sex": "Female"
}
+ Delete: [DELETE] http://localhost:3060/api/users/{id}

2. Proxy Server

# Move to `proxy` folder
$ cd proxy/

# Start proxy
$ python3 proxy.py

# Success 
# Proxy is running on [:::]8080

# Testing CRUD APIs via the proxy
+ Get by id: [GET] http://localhost:8080/api/users/{id}
+ Get all: [GET] http://localhost:8080/api/users
+ Create: [POST] http://localhost:8080/api/users
{
    "fullName": "Khac Duy Lam",
    "age": 25,
    "sex": "Male"
}
+ Update: [PUT] http://localhost:8080/api/users/{id}
{
    "fullName": "Khac Duy Lam updated",
    "age": 26,
    "sex": "Female"
}
+ Delete: [DELETE] http://localhost:8080/api/users/{id}

3. Django Server

# Move to `django_server` folder
$ cd django_server/

# Migrate db 
$ python3 manage.py migrate

# Start server
$ python3 manage.py runserver

# Check if the server is started by copy & paste this link to browser
# http://127.0.0.1:8000/admin/

4. Setup and perform CRUD operations on django admin Interface

  • Create admin login info
$ python3 manage.py createsuperuser

Contact:

hb's People

Contributors

khacduylam avatar

Watchers

 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.