Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Refactor server handler #43

Merged
merged 5 commits into from
Jan 9, 2019
Merged

Refactor server handler #43

merged 5 commits into from
Jan 9, 2019

Conversation

wusyong
Copy link

@wusyong wusyong commented Jan 8, 2019

Refine boost library with served as http server handler. Following API requests with GET are also implemented:

  • GET /tag
  • GET /tips (only fetch all tips for now)
  • GET /address

@wusyong wusyong requested a review from jserv January 8, 2019 06:53
server.cc Outdated Show resolved Hide resolved
server.cc Outdated Show resolved Hide resolved
server.cc Outdated Show resolved Hide resolved
server.cc Outdated Show resolved Hide resolved
Copy link
Member

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should summarize the changes within commit messages.

@jserv jserv added the A-core Area - Internals and/or core implementation label Jan 8, 2019
BUILD Outdated Show resolved Hide resolved
server.cc Outdated Show resolved Hide resolved
Yu Wei Wu added 3 commits January 9, 2019 11:18
Refine boost library with served as http server handler. Following API
requests with GET are also implemented:

* GET /tag
* GET /tips (fetch all tips)
* GET /address
return EXIT_SUCCESS;
#include <served/plugins.hpp>
#include <served/served.hpp>
#include "./apis.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix ./ looks redundant. Can you eliminate it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for cpplint:

Include the directory when naming .h files  [build/include] [4]

config.h Outdated
// Address binding and port for tangle-accelerator
#define TA_HOST "localhost"
#define TA_PORT "8000"
#define TA_THREAD 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be explicit if changed to TA_THREAD_COUNT.

server.cc Outdated
cJSON_AddStringToObject(json_obj, "message", "Invalid path");
const char* json = cJSON_PrintUnformatted(json_obj);

res.set_status(400);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you enumerate the possible error codes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Tangle-Accelerator Core API. We have 400 for client bad request and 404 for request not found.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's introduce macro(s) to map these error codes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-core Area - Internals and/or core implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants