I need to put some code from Linux's configuration files and some JavaScript in a document. I have tried to use \texttt
, it worked for some Linux's basic commands like sudo apt-get install XYZ
, but the code that I need to insert have #
for comments and $
for variables.
Is there some special tag for this?
Here some example of the code that I need to paste in document:
JavaScript:
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev', // Endereço do banco de dados mongodb com a porta padrão
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId', //Identificação da aplicação
masterKey: process.env.MASTER_KEY || '', //Add your master key here$ //Chave secreta para o aplicativo se conectar ao servidor
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',$
//URL que vai estar disponível após o parse-server iniciar
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support f$
}
Configuration File:
# HTTPS — proxy all requests to the Node app
server {
# Adiciona o HTTP/2
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name app.example.com;
}
I'm using ShareLatex. I don't know if it can make any difference on this part.
Best Answer
Use the
listings
package. Unfortunately, there are no syntax highlighting patterns for Javascript inlistings
.Because most of the lines in your code are too wide for the page you should apply my solution for lstlisting line wrapping.