Skip to content

Instantly share code, notes, and snippets.

View Andresdst's full-sized avatar
🧛
Night Developer

Andres Sanchez Andresdst

🧛
Night Developer
View GitHub Profile
{
"initialState": {
"mylist": [],
"trends": [
{
"id": 2,
"slug": "tvshow-2",
"title": "In the Dark",
"type": "Scripted",
"language": "English",
@Andresdst
Andresdst / slugify.js
Created April 29, 2020 20:37
funcion convertidora de slugs
function slugify(text) {
return text
.toString()
.toLowerCase()
.replace(/\s+/g, "-") // Replace spaces with -
.replace(/[^\w\-]+/g, "") // Remove all non-word chars
.replace(/\-\-+/g, "-") // Replace multiple - with single -
.replace(/^-+/, "") // Trim - from start of text
.replace(/-+$/, ""); // Trim - from end of text
};
@Andresdst
Andresdst / categories.js
Last active August 14, 2023 19:10 — forked from urielhdz/categories.js
CRUD de categories
const Category = require('../models').Category;
module.exports = {
create: function(req,res){
Category.create({
title: req.body.title,
color: req.body.color
}).then(result =>{
res.json(result);