Blog System Development - UlordChain/ulord-blog-demo GitHub Wiki

Blog Introduction

A blog system demo based on ulord open platform on nodejs middle layer, express framework and paython back-end. address: http://blogs.ulord.one:10583/blog/login

Environment preparation

1.Install node.js

Go to nodejs official website to download the corresponding system installation package, the version is greater than 8.0, and follow the prompts to install.

Verify successful installation.

$ node -v

2.Install python

Install python2.7.14,which can be downloaded on the officia website.

Build a blog

1.Download the blog codes from github

$ git clone https://github.com/UlordChain/ulord-blog-demo.git

2.Install

cd ulord-blog-demo/js/ulord-blog
npm install

Build back-end SDK

1.Clone ulord platform SDK Project and Install

git clone https://github.com/UlordChain/py-ulord-api.git
cd py-ulord-api
python setup.py install

2.Operate

cd ulord-blog-demo/python
python junior.py
cd ulord-blog-demo/js/ulord-blog
npm start

Enter localhost:3000 in the browser to see the blog

Blog Development Guide

1.How to call the back-end SDK

In Nodejs environment,you can user the request.js library to make http requests For example,call the login interface

var options = {
    url: '127.0.0.1:5000/user/login', //login request
    method: 'POST',
    json: true,
    headers: {
      "content-type": "application/json",
    },
    body: {
      username: username,
      password: userpass,
    }
  }
  request(options, function(error, response, data) {
   ...
  })

In html,take login request through ajax

$.ajax({
  async: false,
  url: '127.0.0.1:5000/user/login',  //login request
  type: 'POST',
  dataType: "json",
  contentType: 'application/json',
  success: function(res) {
    ...
  }
})