How to use the getStatusText function from http-status-codes
Find comprehensive JavaScript http-status-codes.getStatusText code examples handpicked from public code repositorys.
GitHub: leer-enye/Project_Leer
26 27 28 29 30 31 32 33 34 35
} = req.body; if (!email || !name) { return res.status(BAD_REQUEST).send({ status: FAIL, message: HttpStatus.getStatusText(BAD_REQUEST), }); } const newUser = new User({
0
3
5
+ 27 other calls in file
8 9 10 11 12 13 14 15 16 17
this.connector = connector; } async getManufacturers({ name }, { me }, info) { if (!me) { throw new ApolloError(invalidToken, getStatusText(UNAUTHORIZED)); } const query = `FOR m IN FULLTEXT(manufacturers, 'name', '${name}') LIMIT 5 RETURN {'id':m._key,'name':m.name}`; const cursor = await this.connector.Query(query); return cursor.all();
0
1
2
+ 3 other calls in file
21 22 23 24 25 26 27 28 29 30
.send('ok'); response .status(HttpStatus.INTERNAL_SERVER_ERROR) .send({ error: HttpStatus.getStatusText(HttpStatus.INTERNAL_SERVER_ERROR) }); ``` ## Codes
103
0
2
+ 11 other calls in file
36 37 38 39 40 41 42 43 44 45
function error(status, err) { return { status: status, data: { statusError: statusCodes.getStatusText(status), err: err } }; }
3
0
7
+ 15 other calls in file
0 1 2 3 4 5 6 7 8 9
const HttpStatus = require('http-status-codes'); class ApiError { constructor(statusCode, message) { this.statusCode = statusCode; this.message = message || HttpStatus.getStatusText(statusCode); } } class ServerError extends ApiError {
0
0
2
+ 15 other calls in file
http-status-codes.StatusCodes is the most popular function in http-status-codes (2750 examples)