There are few below options available for a cookie,
document.cookie = "username=John; expires=Sat, 8 Jun 2019 12:00:00 UTC";
document.cookie = "username=John; path=/services";