UFSCar DW EES

Está página é para os alunos da UFSCar Campus Sorocaba, especialização em Engenharia de Software EES, disciplina desenvolvimento Web (DW) com Node.js.

1 – Slides da Aula 1

Link

2 – Códigos Fontes da Aula 1

https://github.com/klebercarvalho/UFSCar-DW-EES/

3 – Acordo Avaliação (Prova, Trabalho, Apresentação)

Link

4 – Lista dos Grupo do Trabalho

Link

5 – Node CRUD Mongo – Tutorial

Link

6 – Node CRUD Mongo – github

Link

7 – Node API Mongo

Link

8 – Node API Mongo – github

Link

9 – Node REST API Auth

Link

10 – Node REST API Auth – github

Link

10 – Top REST API Best Practices

11- Exercícios – Estilo e potenciais perguntas para a prova

Link

12- TDD Node Mocha Chai

Link

13- TDD Node Jest

Link

14 – Prova

Link

Enterprises Are Embracing Microservices and Node.js

6 Main Reasons Why Node.js Has Become a Standard Technology for Enterprise-Level Organizations
https://www.monterail.com/blog/nodejs-development-enterprises

Why Enterprises Are Embracing Microservices and Node.js
https://thenewstack.io/enterprises-embracing-microservices-node-js/

Python and requirements.txt

Why requirements.txt?

Any application typically has a set of dependencies that are required for that application to work. The requirements file is a way to specify and install specific set of package dependencies at once.

Format for requirements file:

requests==1.2.0
Flask==0.10.1

Method 1:

$ pip freeze > requirements.txt

Use pip’s freeze command to generate a requirements.txt file for your project: If you save this in requirements.txt, then you can pip install -r requirements.txt.

Method 2:

Use pipreqs – pipreqs used to generate requirements.txt file for any project based on imports

Why not pip freeze ?
pip freeze saves all packages in the environment including those that you don’t use in your current project. (if you don’t have virtualenv)
pip freeze only saves the packages that are installed with pip install in your environment.
sometimes you just need to create requirements.txt for a new project without installing modules.

How to use?

$ pip install pipreqs

$ pipreqs /path/to/project

for additional options see https://github.com/bndr/pipreqs

 

Google Code Prettify and WordPress plugin

Google Code Prettify enable syntax highlight to source code in HTML page. In WordPress you can use Simple Code Highlighter plugin.

To use the Google Code Prettify plugin, place your code within a <pre> text block, and then specify the class of the block as “prettyprint”.  To do this, switch to Text mode within the WordPress editor.

You can use pre tag and class=”prettyprint” attribute to your code

// your code here

Here are some examples:

Default

Many
lines
of
code

Default with line numbers

Many
lines
of
code

Java

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Prints the string to the console.
    }
}

Python

class SchoolMember:
    '''Represents any school member.'''
    def __init__(self, name, age):
        self.name = name
        self.age = age
        print('(Initialized SchoolMember: {})'.format(self.name))

    def tell(self):
        '''Tell my details.'''
        print('Name:"{}" Age:"{}"'.format(self.name, self.age), end=" ")


class Teacher(SchoolMember):
    '''Represents a teacher.'''
    def __init__(self, name, age, salary):
        SchoolMember.__init__(self, name, age)
        self.salary = salary
        print('(Initialized Teacher: {})'.format(self.name))

    def tell(self):
        SchoolMember.tell(self)
        print('Salary: "{:d}"'.format(self.salary))


class Student(SchoolMember):
    '''Represents a student.'''
    def __init__(self, name, age, marks):
        SchoolMember.__init__(self, name, age)
        self.marks = marks
        print('(Initialized Student: {})'.format(self.name))

    def tell(self):
        SchoolMember.tell(self)
        print('Marks: "{:d}"'.format(self.marks))

t = Teacher('Mrs. Shrividya', 40, 30000)
s = Student('Swaroop', 25, 75)

# prints a blank line
print()

members = [t, s]
for member in members:
    # Works for both Teachers and Students
    member.tell()

Node.js

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World!');
}).listen(8080);