This is an anime blog, with uploaded images, blog, comments, dark mode and auth system with jwt
Users should be able to:
- Could Log In
- Could Sign Up
- could log Out
- Switch on dark mode o normal mode theme
- The user just has to sign up one time and then just log in, at least the user wants to make another user
- If the user log in, the user don't have to log in again until 3 days after, at least that he log out
- If the user has been registering already could :
- See all blogs
- See random Quotes
- See blog details
- Post comments on the blog
- Post and create blogs
- If the user is the owner of the blog could:
- Edit the Blog
- Delete the Blog
- NodeJs - NodeJS
- Ejs - NodeJs Template
- Multer - NodeJs Midleware for handle Multiparty
- Validator - NodeJs Validator
- Cookie-parser Handle cookies on NodeJs
- Bcrypt - Safely Store password
- jsonwebtoken - Create Tokens
- MongoDb - MongoDb
- Mongoose - Object Modeling for nodeJs
- ExpressJs - NodeJs Framework
This api provides blogs and comments that user has already created or posted
main route :
These examples exclude the view template EJS by default and auth middleware also you have to be a login already to get all these data. This is just a guide that things you could expect to get from API that exclude the view template
fetch('https://blog-anime-node.herokuapp.com/blogs')
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"title":"aaaa",
"body":"eeee",
"user:":"email.com",
"filename":"esss",
"content-type":"esss",
"imageBased64":"esoo",
"comments":["esoo"],
"email":["user@gmail.com"]
}
]
the id : blog_id
fetch(`https://blog-anime-node.herokuapp.com/blogs/${id}`)
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"title":"aaaa",
"body":"eeee",
"user:":"email.com",
"filename":"esss",
"content-type":"esss",
"imageBased64":"esoo",
"comments":["esoo"],
"email":["user@gmail.com"]
}
]
const formData = new FormData(this)
fetch('https://blog-anime-node.herokuapp.com/blogs', {
method:"POST",
body:formData,
})
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"newBlog":"SADFASDASD",
"location":"/blogs/newBlog"
}
]
newBlog means the id of the new blog the location, it's the route for details of the blog
[
{
"errors":{
"title":"",
"body":""
}
}
]
These errors are based on mongoose handle Errors
const formData = new FormData(this)
const id = blog._id
fetch(`https://blog-anime-node.herokuapp.com/blogs/update/${id}`, {
method:"PUT",
body:formData,
})
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"errors":{
"title":"",
"body":""
}
}
]
The location, it's the route for details of the old blog
[
{
"state":"update",
"location":"/blogs/id_old_blog"
}
]
The location, it's the route for details of the old blog
For the comment actually, the blog is updated
const {email, comment} = form
const id = blog._id
fetch(`https://blog-anime-node.herokuapp.com/blogs/update/${id}`, {
method:"PUT",
headers:{"Content-Type":"application/json"},
body:JSON.stringify({ email, comment }),
})
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"state":"Successfull",
"location":"/blogs/id_old_blog"
}
]
const id = blog._id
fetch(`blogs/${id}`, {
method:"DELETE",
})
.then(request => request.json())
.then(data => console.log(data))
.catch(err => console.log(err.message))
[
{
"state":"delete",
"location":"/blogs"
}
]
[
{
"errors":"try again"
}
]
The API for auth is for registering new users on the database and login with cookies
The app is hosting on Heroku so kind of slow because you have to pay for dynos and I can't pay