I need to use Captcha in MEAN js login. I need the simplest possible way to make it work. I saw Visual Captcha but I'm not able to understand where should I use it in the MEAN js application.
I need an offline captcha solution on MEAN js app. I plan to deploy it on a raspberry pi.
You can use google recaptcha with external script file in mean stack page. There is a js code.
https://developers.google.com/recaptcha/docs/display#js_api
Just follow this.
<script type="text/javascript">
var onloadCallback = function() {
grecaptcha.render('html_element', {
'sitekey' : 'your_site_key'
});
};
</script> </head> <body>
<form action="?" method="POST">
<div id="html_element"></div>
<br>
<input type="submit" value="Submit">
</form>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
async defer>
</script> </body> ```
Related
I've been stuck on this functionality for awhile. I've tried the frontend ways and backend as well. things I've tried doing are sending limited data from backend as response https://youtu.be/vP9fOEAlo74 this video was very close to solving my problem but i couldn't figure it out. I want a path or way to do this in best way possible.
frontend ejs file code:
<%- include("partials/header"); -%>
<% posts.forEach(function(post){ %>
<h2><%=post.title%></h2>
<p>
<%=post.content.substring(0, 440) + " ..."%>
<a class="styleAnchor" href="/posts/<%=post._id%>">Read More</a>
</p>
<% }) %>
<%- include("partials/footer"); -%>
backend code:
app.get("/blogs", function(req,res){
Post.find({}, function(err, posts){
res.render("blogs", {posts: posts});
});
});
the website is currently live on heroku app and data comes from mongodb atlas
feel free to visit to understand.
thank you for your time!
I work with express and vue3 I have found multiple solutions but they all do not seem to work because of vue
I have something like this
<template>
<div>
<button v-on:click="exit"></button>
</div>
</template>
and I just want to close the application with this.
<script>
function exit() {
process.exit(1)
}
</script>
I am developing an E - Commerce website in React and Node.js. I am facing two problems described below.
I have two different master .html files for admin side and front end side. Hence I am using builtin React admin template in which index.html is loading on project start. My problem is how can I load another master .html for front end design?
I want to use Node.js as the back end. Hence I can not integrate node.js with React front or admin side which will run if the React application runs.
Any suggestions or solution steps will be highly appreciated.
Here's a very basic concept of the first idea:
const AdminIndexPage = children => (<section className="AdminIndexPage">{children}</section>)
const PublicIndexPage = children => (<section className="PublicIndexPage">{children}</section>
const App = props => {
if(props.indexPageToShow === 'admin'){
return <AdminIndexPage {...props} />
}else{
return <PublicIndexPage {...props} />
}
}
Here's a very basic concept of the second idea:
index.html
<html>
<head>
<script src="index.js"></script>
</head>
<body>
<div id="AdminPageIndex"></div>
<div id="PublicPageIndex"></div>
</body>
</html>
index.js
import {AdminPageIndex, PublicPageIndex} from './pages'
ReactDOM.render(AdminPageIndex, document.getElementById('AdminPageIndex'))
ReactDOM.render(PublicPageIndex, document.getElementById('PublicPageIndex'))
I am developing a crud application in nodejs using handlebars templating engine. Now I want to add editor like ckeditor or any similar kind of editor in my application.
CKEditior is a front-end plug-in that runs directly in the browser you use it like any other front-end js plugin here is an example
<div class="entry">
<script src="https://cdn.ckeditor.com/4.9.1/standard/ckeditor.js"></script>
<h1>{{title}}</h1>
<div class="body">
<textarea name="editor1"></textarea>
<script>
CKEDITOR.replace( 'editor1' );
</script>
{{body}}
</div>
</div>
in the json:
{
title: "My New Post",
body: "This is my first post!"
}
you can try it here: tryhandlebar
I am building simple web app that if the user press button, it will make sound(mp3 file in the server side).
//html file
<script>
function playSound () {
document.getElementById('play').play();
}
</script>
<body>
<audio id='play', src='http://127.0.0.1:1337/', type='audio/mpeg'
<button onclick='playSound()' class='btn btn-danger btn-circle btn-lg'>
<i class='fa fa-5x fa-fire'>
</body>
//app.js
app.get('/music.mp3', function(req, res){
ms.pipe(req, res, "/music.mp3");
});
It works if I insert online source in audio attribute, but it does not serve my local server file. How can I fix this?
Thanks in advance!
To serve static files such as images, CSS files, and JavaScript files, audio, use the express.static built-in middleware function in Express.
app.use(express.static('public'));
I've already answered such type of question. See this answer