Skip to content

Releases: mateuszarchicinski/Restful-API--NodeJS-ExpressJS

Restful API - NodeJS & ExpressJS

25 Mar 14:51
Compare
Choose a tag to compare

In Restful API 1.0.1 version the following changes have been made:

Normal mode:

  • depends entirely on the configuration in file project.config.js,
  • allows you to create any number of pages in five types: main, normal, 404, 500, and redirect (examples in file project.config.js),
  • defined default name of pages which will be displayed as a main page, error 404 page, error 500 page and redirect page,
  • defined default directory for pages,
  • home page is displayed in cases: https://YOUR_HOST, https://YOUR_HOST/en and https://YOUR_HOST/en/home,
  • error page 404 is displayed in cases: not a valid language, not finding a page and too many parameters in a request e.g https://YOUR_HOST/en/home/idk,
  • error page 404 is displayed also in a case when requested page object contains wrong file name to display,
  • error page 500 is displayed in a case when there is an error in your newly added routing route,
  • supports HTTP errors by displaying pages 404 and 500,
  • page 500 is displayed in each undefined error case.

Angular mode:

  • added a condition of redirecting to the main page in a case of a request https://YOUR_HOST///*,
  • all error responses are sent as a JSON e.g {message: err.message, statusCode: err.statusCode || 500}.

Both modes:

  • choice of any modes is possible in file project.config.js,
  • defined default HTTP codes response of error, redirect and success,
  • added a lot useful functions e.g getLang(req.params.lang) and getPage({param: 'name', value: req.params.page}),
  • added a place where you can add new routes,
  • detected already all possible routes.

More information can be found directly in the code, where you will find a lot of interesting comments.

Restful API - NodeJS & ExpressJS

13 Mar 23:49
Compare
Choose a tag to compare

For more info check readme file.