View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

res.type()

Sets the "Content-Type" response header to the specified type.

This method is pretty forgiving (see examples below), but note that if type contains a "/", res.type() assumes it is a MIME type and interprets it literally.

Usage

res.type(type);

Example

res.type('.html');
res.type('html');
res.type('json');
res.type('application/json');
res.type('png');

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book