Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
tc-api/routes.js at master · skyhit/tc-api · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
skyhit
tc-api
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
tc-api
/
routes.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
154 lines (131 loc) · 6.86 KB
master
Breadcrumbs
tc-api
/
routes.js
Copy path
Top
File metadata and controls
Code
Blame
154 lines (131 loc) · 6.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* Copyright (C) 2013 - 2014 TopCoder Inc., All Rights Reserved.
*
*
@version
1.11
*
@author
vangavroche, Sky_, TCSASSEMBLER, muzehyun, Ghost_141
* Changes in 1.1:
* - add routes for search challenges
* Changes in 1.2:
* - add route for top
* Changes in 1.3:
* - add routes for all stub methods
* - add routes for cache test
* Changes in 1.4:
* - reorder route for studio contest details
* Changes in 1.5:
* - add routes for software rating history and distribution
* - reorder route for studio challenge details
* Changes in 1.6:
* - add route oauth test
* Changes in 1.7:
* - add route oauth
* Changes in 1.8:
* - add route for bugs
* Changes in 1.9:
* - add route for client challenge costs
* Changes in 1.10:
* - added routes for terms api
* Changes in 1.11:
* - add invoice history api.
*/
/* ---------------------
routes.js
For web clients (http and https) you can define an optional RESTful mapping to help route requests to actions.
If the client doesn't specify and action in a param, and the base route isn't a named action,
the action will attempt to be discerned from this routes.js file.
- routes remain optional
- actions defiend in params directly `action=theAction` or hitting the named URL for an action `/api/theAction`
will always override RESTful routing
- you can mix explicitly defined params with route-defined params. If there is an overlap, the route-defined params win
- IE: /api/user/123?userId=456 => `connection.userId = 123`
- this is a change from previous versions
- routes defined with the "all" method will be duplicated to "get", "put", "post", and "delete"
- use ":variable" to defined "variable"
- undefined ":variable" will match
- IE: "/api/user/" WILL match "/api/user/:userId"
- routes are matched as defined here top-down
- you can optionally define a regex match along with your route variable
- IE: { path:"/game/:id(^[a-z]{0,10}$)", action: "gamehandler" }
- be sure to double-escape when needed: { path: "/login/:userID(^\\d{3}$)", action: "login" }
example:
{
get: [
{ path: "/users", action: "usersList" }, // (GET) /api/users
{ path: "/search/:term/limit/:limit/offset/:offset", action: "search" }, // (GET) /api/search/car/limit/10/offset/1
],
post: [
{ path: "/login/:userID(^\\d{3}$)", action: "login" } // (POST) /api/login/123
],
all: [
{ path: "/user/:userID", action: "user" } // (*) / /api/user/123
]
}
---------------------- */
/**
* Methods that are used only in test cases.
*/
var
testMethods
=
{
get
:
[
{
path
:
"/test/cache/oauth"
,
action
:
"cacheTestOAuth"
}
,
{
path
:
"/test/cache/error"
,
action
:
"cacheTestError"
}
,
{
path
:
"/test/cache/hits"
,
action
:
"cacheTestGetHits"
}
,
{
path
:
"/test/cache/reset"
,
action
:
"cacheTestResetHits"
}
,
{
path
:
"/test/cache/disabled"
,
action
:
"cacheDisabled"
}
,
{
path
:
"/test/cache"
,
action
:
"cacheTest"
}
,
{
path
:
"/test/oauth"
,
action
:
"oauthTest"
}
]
}
;
////////////
// ROUTES //
////////////
exports
.
routes
=
{
get
:
[
{
path
:
"/:apiVersion/logs"
,
action
:
"getLogTail"
}
,
{
path
:
"/:apiVersion/challenges"
,
action
:
"searchSoftwareAndStudioChallenges"
}
,
{
path
:
"/:apiVersion/develop/challengetypes"
,
action
:
"softwareTypes"
}
,
{
path
:
"/:apiVersion/develop/challenges/:contestId"
,
action
:
"getSoftwareChallenge"
}
,
{
path
:
"/:apiVersion/develop/statistics/tops/:contestType"
,
action
:
"getTops"
}
,
{
path
:
"/:apiVersion/develop/statistics/:handle/:challengeType"
,
action
:
"getSoftwareRatingHistoryAndDistribution"
}
,
{
path
:
"/:apiVersion/develop/challenges"
,
action
:
"searchSoftwareChallenges"
}
,
{
path
:
"/:apiVersion/develop/reviewOpportunities"
,
action
:
"searchReviewOpportunities"
}
,
{
path
:
"/:apiVersion/design/challengetypes"
,
action
:
"studioTypes"
}
,
{
path
:
"/:apiVersion/design/reviewOpportunities/:id"
,
action
:
"getStudioReviewOpportunity"
}
,
{
path
:
"/:apiVersion/design/challenges/:contestId"
,
action
:
"getStudioChallenge"
}
,
{
path
:
"/:apiVersion/design/challenges"
,
action
:
"searchStudioChallenges"
}
,
{
path
:
"/:apiVersion/design/reviewOpportunities"
,
action
:
"getStudioReviewOpportunities"
}
,
{
path
:
"/:apiVersion/users/:handle/statistics/develop"
,
action
:
"getSoftwareStatistics"
}
,
{
path
:
"/:apiVersion/users/:handle/statistics/design"
,
action
:
"getStudioStatistics"
}
,
{
path
:
"/:apiVersion/users/:handle/statistics/data/marathon"
,
action
:
"getMarathonStatistics"
}
,
{
path
:
"/:apiVersion/users/:handle/statistics/data/srm"
,
action
:
"getAlgorithmStatistics"
}
,
{
path
:
"/:apiVersion/users/:handle"
,
action
:
"getBasicUserProfile"
}
,
{
path
:
"/:apiVersion/data/srm/challenges/:id"
,
action
:
"getSRMChallenge"
}
,
{
path
:
"/:apiVersion/data/srm/challenges"
,
action
:
"searchSRMChallenges"
}
,
{
path
:
"/:apiVersion/data/marathon/challenges/:id"
,
action
:
"getMarathonChallenge"
}
,
{
path
:
"/:apiVersion/data/marathon/challenges"
,
action
:
"searchMarathonChallenges"
}
,
{
path
:
"/:apiVersion/data/marathon/statistics/tops"
,
action
:
"getMarathonTops"
}
,
{
path
:
"/:apiVersion/data/srm/statistics/tops"
,
action
:
"getSRMTops"
}
,
{
path
:
"/:apiVersion/data/countries"
,
action
:
"countries"
}
,
{
path
:
"/:apiVersion/terms/:challengeId(\\d+)"
,
action
:
"getChallengeTerms"
}
,
{
path
:
"/:apiVersion/terms/detail/:termsOfUseId"
,
action
:
"getTermsOfUse"
}
,
//example secure route using oauth. for future reference.
{
path
:
"/:apiVersion/secure/challengetypes"
,
action
:
"softwareTypesSecured"
}
,
{
path
:
"/:apiVersion/platform/statistics"
,
action
:
"tcDirectFacts"
}
,
{
path
:
"/:apiVersion/download/document/:docId"
,
action
:
"downloadDocument"
}
,
{
path
:
"/:apiVersion/reports/client/costs"
,
action
:
"getClientChallengeCosts"
}
,
{
path
:
"/:apiVersion/reports/costs/:startDate/:endDate"
,
action
:
"getChallengeCosts"
}
,
{
path
:
"/:apiVersion/bugs/:jiraProjectId/:status"
,
action
:
"bugs"
}
,
{
path
:
"/:apiVersion/bugs/:jiraProjectId"
,
action
:
"bugs"
}
,
{
path
:
"/:apiVersion/bugs"
,
action
:
"bugs"
}
,
//Stubs APIs
{
path
:
"/:apiVersion/software/reviewOpportunities/:id"
,
action
:
"getReviewOpportunity"
}
,
{
path
:
"/:apiVersion/data/reviewOpportunities/:id"
,
action
:
"getAlgorithmsReviewOpportunity"
}
,
{
path
:
"/:apiVersion/data/reviewOpportunities"
,
action
:
"getAlgorithmsReviewOpportunities"
}
,
{
path
:
"/:apiVersion/software/reviewers/:contestType"
,
action
:
"getChallengeReviewers"
}
,
{
path
:
"/:apiVersion/design/statistics/tops/:challengeType"
,
action
:
"getStudioTops"
}
,
{
path
:
"/:apiVersion/data/challengetypes"
,
action
:
"algorithmsChallengeTypes"
}
]
.
concat
(
testMethods
.
get
)
,
post
:
[
{
path
:
"/:apiVersion/users"
,
action
:
"memberRegister"
}
,
{
path
:
"/:apiVersion/auth"
,
action
:
"generateJwt"
}
]
}
;
You can’t perform that action at this time.